Skip to content
/ skel Public

Skeleton app using Silex, Supermodel, and Ladder

License

Notifications You must be signed in to change notification settings

Drarok/skel

Repository files navigation

Skel

This is a ready-to-roll skeleton app using:

Quick Start

  • Clone this repository
  • Copy and edit the sample config files (/ladder.sample.json, and /config/db.sample.json)
  • Create your own controllers and other classes either in the Skel namespace, or your own (don't forget to update composer.json if you create your own)
  • Register your routes in src/app.php
  • (Optional) Remove the example HomeController
  • Enjoy!

Creating database tables via migrations

Skel doesn't offer any "magic", but does include a database migrations tool, Ladder. To create a migration:

vendor/bin/ladder create 'Migration name'

This will create a file, and show you its path for editing.

An example migration would look something like this:

class Migration1504867317 extends AbstractMigration
{
    public function getName()
    {
        return 'Create users table';
    }

    public function apply()
    {
        Table::factory('users')
            ->addColumn('id', 'autoincrement', ['null' => false, 'unsigned' => true])
            ->addColumn('username', 'varchar', ['null' => false, 'limit' => 50])
            ->addColumn('passwordHash', 'varchar', ['null' => false, 'limit' => 255]) // Size recommended by http://php.net/manual/en/function.password-hash.php
            ->addIndex('PRIMARY', ['id'])
            ->addIndex('username', null, ['unique' => true])
            ->create()
        ;
    }

    public function rollback(array $data = null)
    {
        Table::factory('users')
            ->drop()
        ;
    }
}

After you've created a migration, you will need to apply it:

vendor/bin/ladder migrate

About

Skeleton app using Silex, Supermodel, and Ladder

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published