2017 © Pedro Peláez
 

library laratools

Some usefull lib outside laravel, like Eloquent, Migartion, Config

image

fureszpeter/laratools

Some usefull lib outside laravel, like Eloquent, Migartion, Config

  • Thursday, April 2, 2015
  • by fureszpeter
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

laratools

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");

The Versions

02/04 2015

dev-master

9999999-dev

Some usefull lib outside laravel, like Eloquent, Migartion, Config

  Sources   Download

MIT

The Requires

 

The Development Requires

by Furesz Peter