Welcome to the Mini Framework! This guide will help you get up and running quickly. The framework is lightweight, beginner-friendly, and requires no Composer or external dependencies.
Download or clone the framework to your web server directory:
# If using git
git clone https://github.com/Nerajsharma/RouteX.git
# Or download and extract the ZIP file
Point your web server's document root to the public/ directory:
# Apache VirtualHost example
<VirtualHost *:80>
ServerName myapp.local
DocumentRoot /path/to/project/public
<Directory /path/to/project/public>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
If you'll be using models, configure your database in config/database.php:
// .env
DB_NAME=mini_framework
DB_USER=root
DB_PASS=
Open routes/web.php and add a route:
// routes/web.php
use Core\Route;
Route::get('/', 'HomeController@index');
php mini make:controller HomeController
// app/Controllers/HomeController.php
namespace App\Controllers;
use Core\Controller;
use Core\Request;
class HomeController extends Controller
{
public function index(Request $request)
{
return $this->view('home', [
'title' => 'Welcome',
'message' => 'Hello, World!'
]);
}
}
// app/Views/home.php
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo $title; ?></title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-50 p-8">
<div class="max-w-4xl mx-auto">
<h1 class="text-4xl font-bold mb-4"><?php echo htmlspecialchars($title); ?></h1>
<p class="text-xl text-gray-600"><?php echo htmlspecialchars($message); ?></p>
</div>
</body>
</html>
Use the built-in PHP development server:
php mini serve
Then visit http://localhost:8000 in your browser.
For production, configure Apache or Nginx to point to the public/ directory.
Now that you have the framework running, explore these topics:
php mini serve - Start serverphp mini route:list - List routesphp mini make:controller - Create controllerphp mini make:model - Create modelphp mini make:middleware - Create middlewareRoute::get() - GET routeRoute::post() - POST routeRoute::middleware() - Add middlewareRoute::group() - Group routes