twitnic / slimer
Artisan-style console tooling for Slim Framework 2 applications.
0.0.1
2026-04-02 15:03 UTC
Requires
- php: >=7.2
- slim/slim: ^2.6
- symfony/console: ^3.4 || ^4.4 || ^5.4 || ^6.4
Requires (Dev)
- phpunit/phpunit: ^8.5.41 || ^9.6
README
twitnic/slimer is a standalone Composer package that gives Slim Framework 2 projects an Artisan-style command line experience.
It ships with:
- a
vendor/bin/slimerconsole entrypoint - Slim 2 bootstrap discovery via
.slimer.php route:listfor inspecting registered routesservefor running the built-in PHP web serverinit,make:command,make:controller,make:middleware, andmake:view- hooks for custom project commands
Installation
composer require twitnic/slimer
Quick start
Initialize the package inside an existing Slim 2 application:
vendor/bin/slimer init
That creates a .slimer.php file. Point the generated bootstrap callback to your Slim entry script if needed, then inspect the available commands:
vendor/bin/slimer list vendor/bin/slimer about vendor/bin/slimer route:list
Configuration
Slimer looks for configuration in this order:
- the path from
SLIMER_CONFIG .slimer.phpconfig/slimer.phpapp/config/slimer.php
Example configuration:
<?php return array( 'bootstrap' => 'app/bootstrap.php', 'commands' => array( App\Console\Commands\CleanupCommand::class, ), 'generators' => array( 'commands_path' => 'app/Console/Commands', 'command_namespace' => 'App\\Console\\Commands', 'controllers_path' => 'app/controllers', 'controller_namespace' => 'App\\Controllers', 'middleware_path' => 'app/middleware', 'middleware_namespace' => 'App\\Middleware', 'views_path' => 'app/views', ), );
Built-in commands
vendor/bin/slimer about vendor/bin/slimer init vendor/bin/slimer route:list vendor/bin/slimer serve --host=127.0.0.1 --port=8080 vendor/bin/slimer make:command Cleanup vendor/bin/slimer make:controller Admin/User vendor/bin/slimer make:middleware ApiAuth vendor/bin/slimer make:view admin/dashboard
Notes
route:listexpects a bootstrappedSlim\Sliminstance.- Prefer a dedicated bootstrap file that builds the application without immediately calling
$app->run(). - Custom commands can either be instantiated directly, returned from a callable, or referenced by class name.
- Generated middleware classes extend
\Slim\Middleware, which matches Slim 2.