diff --git a/README.md b/README.md index 526ebdd..d6565f5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Laravel Database URI -Drop-in package to translate a database URI into database config values. No more need to add logic to your +# Laravel Database URL +Drop-in package to translate a database URL into database config values. No more need to add logic to your `config/database.php` file. -This is meant to help prevent the need for manually parsing database URIs, like the ones that come from Heroku or AWS. -It will take a URI and assign host, password, username, port, (etc.) components to the default driver or +This is meant to help prevent the need for manually parsing database URLs, like the ones that come from Heroku or AWS. +It will take a URL and assign host, password, username, port, (etc.) components to the default driver or specific driver(s) of your choosing. This __will override__, at runtime, any `default` database connection values for `host`, `port`, `username`, `password`, and `database` @@ -14,12 +14,12 @@ This __will override__, at runtime, any `default` database connection values for - Laravel >= 5.6 ## Installation -`$ composer require rootinc/laravel-db-uri` +`$ composer require rootinc/laravel-db-url` ## Configuration The package will automatically map the parsed values from the environment variable `DATABASE_URL` to the `default` database connection. -Add a `DATABASE_URL` entry to your `.env` or server environment with a URI to your default database. +Add a `DATABASE_URL` entry to your `.env` or server environment with a URL to your default database. `DATABASE_URL=postgresql://username:password@localhost:5432/database-name` This will overwrite database connection values for `host`, `port`, `username`, `password`, and `database` @@ -28,12 +28,12 @@ This will overwrite database connection values for `host`, `port`, `username`, ` ## Customization Override default behaviour by publishing the config file and setting values. -`$ php artisan vendor:publish --tag=db-uri` +`$ php artisan vendor:publish --tag=db-url` Set any database connections by supplying `default` or the key path, like `connections.pgsql`, or `redis` to have a URL mapped onto the connection at that key path. -config/db-uri.php +config/db-url.php ``` return [ 'default' => 'SOME_DATABASE_URL', // "default" resolves key path from default key diff --git a/composer.json b/composer.json index fd33285..3759b75 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "rootinc/laravel-db-uri", - "description": "Translates a database URI into Laravel database driver values.", + "name": "rootinc/laravel-db-url", + "description": "Translates a database URL into Laravel database driver values.", "keywords": ["php", "laravel", "database", "env"], "type": "library", "require": { @@ -16,13 +16,13 @@ ], "autoload": { "psr-4": { - "RootInc\\LaravelDbUri\\": "src/" + "RootInc\\LaravelDbUrl\\": "src/" } }, "extra": { "laravel": { "providers": [ - "RootInc\\LaravelDbUri\\LaravelDbUriServiceProvider" + "RootInc\\LaravelDbUrl\\LaravelDbUrlServiceProvider" ] } }, diff --git a/src/LaravelDbUriServiceProvider.php b/src/LaravelDbUrlServiceProvider.php similarity index 89% rename from src/LaravelDbUriServiceProvider.php rename to src/LaravelDbUrlServiceProvider.php index de37da6..2be6402 100644 --- a/src/LaravelDbUriServiceProvider.php +++ b/src/LaravelDbUrlServiceProvider.php @@ -1,10 +1,10 @@ publishes([ - __DIR__.'/config/db-uri.php' => config_path('db-uri.php') - ], 'db-uri'); + __DIR__.'/config/db-url.php' => config_path('db-url.php') + ], 'db-url'); $this->mergeConfigFrom( - __DIR__.'/config/db-uri.php', 'db-uri' + __DIR__.'/config/db-url.php', 'db-url' ); // All driver/connection mappings from config - $connections = config('db-uri'); + $connections = config('db-url'); // Loop and set each connection foreach($connections as $driver_path => $connection_key) { diff --git a/src/config/db-uri.php b/src/config/db-url.php similarity index 100% rename from src/config/db-uri.php rename to src/config/db-url.php