otis22 / cleardb-url
Clear-db-url parser.
1.0.0
2021-12-28 18:06 UTC
Requires (Dev)
- php: ^7.4
- otis22/php-coverage-checker: ^1.2
- phpstan/phpstan: ^0.12.19
- phpunit/phpunit: ^9.1
- symplify/easy-coding-standard: ^9.3
This package is auto-updated.
Last update: 2024-11-29 06:41:38 UTC
README
Clear-db-url parser. Cleardb is a db as service. Useful for heroku users.
How to use
Install package
composer require otis22/cleardb-url
For heroku users
Heroku server put clearDb url to environments. This function use env with name CLEARDB_DATABASE_URL.
use function Otis22\ClearDb\credential; $credential = credential(); $credential->db(); #db name $credential->driver(); #db type(mysql, pgsql, ...) $credential->host(); #host $credential->pass(); #password $credential->user(); #user
For phinx on heroku
use function Otis22\ClearDb\phinx; return [ ... 'environments' => [ 'default_migration_table' => 'phinxlog', 'default_environment' => 'production', 'production' => phinx()->asArray() ], ...
Parse custom clearDb url
use Otis22\ClearDb\ParsedUrl; use Otis22\ClearDb\Credential; $credential = new Credential( new ParsedUrl('mysql://user:pass@host/dbname?reconnect=true') ); # Available for getting db credentials $credential->db(); ...
Contributing
For run all tests
make all
or connect to terminal
make exec
or use built in php server http://localhost:8080
# start server on 8080 port make serve # custom port 8081 make serve PORT=8081
Dafault php version is 7.4. Use PHP_VERSION= for using custom version.
make all PHP_VERSION=8.0 # run both make all PHP_VERSION=7.4 && make all PHP_VERSION=8.0
all commands
# composer install make install # composer install with --no-dev make install-no-dev # check code style make style # fix code style make style-fix # run static analyze tools make static-analyze # run unit tests make unit # check coverage make coverage