⚠️ Work in progress so keep calm. The good news: this is maintained!
- php ^7.4 || ^8.0
- mysql
- composer
- yarn
Available commands (see hook_local.sh file)
Composer
composer install --no-suggest
Yarn
yarn install
Webpack
npx webpack --mode=development
Drop database
composer cli skeleton:database:drop
Migrations (located in src/Infrastructure/Migrations directory)
vendor/bin/phinx create MyFirstMigration -c app/phinx.php ## generate a migration
vendor/bin/phinx migrate -c app/phinx.php ## migrate
Fixtures (located in src/Infrastructure/Fixtures directory and declare in settings.php in fixtures section)
composer cli skeleton:fixtures:load
Commands must be placed in src/Application/Command directory and implement src/Application/Command/CommandInterface
<?php
namespace App\Application\Command;
use RuntimeException;
/**
* Class SampleCommand
* @package App\Application\Command
*/
class SampleCommand extends AbstractCommand
{
/**
* @param $args
* @return int
*/
public function command($args): int
{
$this->info('Creating sample');
// Access items in container
$settings = $this->container->get('settings');
// Throw if no arguments provided
if (empty($args)) {
throw new RuntimeException("ERROR! No arguments passed to command");
}
$this->write("Argument 0: {$args[0]}");
$this->success('Sample successfully created');
return 0;
}
}
Declare your command in settings.php in commands section.
$containerBuilder->addDefinitions([
'commands' => [
'skeleton:sample' => SampleCommand::class,
],
]);
You can now call that command with composer
composer cli skeleton:sample arg1 arg2
The Slim Skeleton is open-sourced software licensed under the MIT license.
© 2023 dev in the hood