The Mini Framework provides a flexible CLI tool for code generation and project automation.
All commands are executed using the mini script in your project root.
| Command | Description |
|---|---|
php mini serve |
Start PHP built-in dev server |
php mini route:list |
List registered routes |
php mini make:controller <Name> |
Generate a controller |
php mini make:model <Name> |
Generate a model |
php mini make:middleware <Name> |
Generate a middleware |
php mini make:component <Name> |
Generate a view component |
Quickly start a development server using PHP’s built-in feature. No Apache/Nginx required.
php mini serve
The server will run at:
Server running at http://localhost:8000
Press Ctrl+C to stop the server
Prints all registered routes in a table for debugging and documentation purposes.
php mini route:list
Sample output:
================================================================================
| METHOD | URI | ACTION | MIDDLEWARE |
================================================================================
| GET | / | HomeController@index | - |
| GET | /user/{id} | UserController@show | - |
| GET | /dashboard | DashboardController@index | auth |
| GET | /profile | UserController@profile | auth |
| GET | /settings | UserController@settings | auth |
================================================================================
Total: 5 route(s)
Columns:
- if noneGenerate a new controller class quickly.
php mini make:controller UserController
Creates file: app/Controllers/UserController.php
<?php
namespace App\Controllers;
use Core\Controller;
use Core\Request;
/**
* UserController - generated by CLI
*/
class UserController extends Controller
{
/**
* Display a listing of the resource
*/
public function index(Request $request, $params = [])
{
return $this->view('home');
}
}
Controller if you forget it. E.g. php mini make:controller User creates UserController.
Generate a new model class, automatically configuring the table name.
php mini make:model User
Creates file: app/Models/User.php
<?php
namespace App\Models;
use Core\Model;
/**
* User model - generated by CLI
*/
class User extends Model
{
protected $table = 'users';
}
Command features:
Model if presentScaffold a new middleware class.
php mini make:middleware AuthMiddleware
Creates file: app/Middleware/AuthMiddleware.php
<?php
namespace App\Middleware;
use Core\Middleware;
use Core\Request;
use Core\Response;
/**
* AuthMiddleware - generated by CLI
*/
class AuthMiddleware extends Middleware
{
/**
* Handle the request
*
* @param Request $request
* @param \Closure $next
* @return Response
*/
public function handle(Request $request, \Closure $next)
{
// Add your logic here
// Continue to next layer
return $next($request);
}
}
Create a reusable Blade/view component.
php mini make:component Navbar
Creates file: app/Views/components/navbar.php
<div class="p-4 bg-white shadow rounded">
<h1 class="text-xl font-bold">Navbar Component</h1>
<p class="text-gray-600 mt-2">This is a generated component. Customize as needed.</p>
</div>
Usage in your views:
<?php
use Core\View;
View::component('navbar');
?>
# Model
php mini make:model Product
# Controller
php mini make:controller ProductController
# Middleware (optional)
php mini make:middleware ProductAuthMiddleware
# Component (optional)
php mini make:component ProductCard
# Start dev server
php mini serve
# List routes in a separate terminal
php mini route:list
Check the following if you encounter "command not found":
mini executable? (chmod +x mini)php mini instead of just miniExisting files are not overwritten. Remove or rename the file if you want to regenerate it.
Now that you know the CLI commands, try:
php mini serve for local testingphp mini route:list