Clear-db-url parser. Cleardb is a db as service. Useful for heroku users.
Install package
composer require otis22/cleardb-url
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
use function Otis22\ClearDb\phinx;
return
[
...
'environments' => [
'default_migration_table' => 'phinxlog',
'default_environment' => 'production',
'production' => phinx()->asArray()
],
...
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();
...
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