If you are using phpmig, you need to create a phpmig.php into your project root folder or PROJECT_ROOT/config folder, (*1)
##phpmig, (*2)
This package depends on phpmig, so you can find the CLI command in vendor/bin/phpmig or vendor/davedevelopment/phpmig/bin/phpmig, (*3)
Example:, (*4)
```
use Phpmig\ConfigDTO;, (*5)
$configAsterisk = new ConfigDTO("mysql", "127.0.0.1", "dbname", "username", "password");, (*6)
$container = new Phpmig\Container(DIR . "/../migrations");
$container->setDatabaseConnection("db", $configAsterisk);
$container->setEloquentCapsule("capsule", $configAsterisk);, (*7)
$container->setAdapter($container["db"]);, (*8)
return $container;, (*9)
and in the migartions file
```<php>
class InitSchema extends Migration
{
const DB_KEY_NAME = "capsule";
/* @var \Illuminate\Database\Schema\Builder $schema */
protected $schema;
public function init()
{
$this->schema = $this->get(self::DB_KEY_NAME)->schema();
}
/**
* Do the migration
*/
public function up()
{
$this->schema->create("states", function ($table) {
/* @var Blueprint $table */
$table->increments("id");
$table->char("code", 2);
$table->string("name", 64);
});
}
}
Config
You can define your environment in a .env file in PROJECT_ROOT, (*10)
Example .env file:, (*11)
ENVIRONMENT=local
If environment is defined and we use during the object creation, (*12)
Config file format, (*13)
return [
"driver" => "mysql"
];
Read config files, without the .env file, (*14)
$config = new Config\Config(new \Symfony\Component\Finder\Finder(), __DIR__ . "/../config/development/");
echo $config->get("test.driver");
Read config files, with the .env file, (*15)
$config = new Config\Config(new \Symfony\Component\Finder\Finder(), __DIR__ . "/../");
echo $config->get("test.driver");