Skip to content

Latest commit

 

History

History
139 lines (101 loc) · 3.35 KB

README.md

File metadata and controls

139 lines (101 loc) · 3.35 KB

logo dev in the hood

License Version

jul6art/slim-skeleton

Base slim project

⚠️ Work in progress so keep calm. The good news: this is maintained!

Requirements

  • php ^7.4 || ^8.0
  • mysql
  • composer
  • yarn

Includes

Commands

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

License

The Slim Skeleton is open-sourced software licensed under the MIT license.

© 2023 dev in the hood