nomhub / blazer
Blazer PHP MVC Framework
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^8.0
This package is auto-updated.
Last update: 2025-02-28 17:04:56 UTC
README
Blazer Framework
A lightning-fast PHP framework for modern web applications
⚡️ Quick Start
Create a new Blazer project using Composer:
composer create-project nomhub/blazer my-app
cd my-app
php blazer serve
Visit http://localhost:8000
in your browser to see your application!
🎯 Features
- ⚡️ Lightning Fast: Optimized for speed with minimal overhead
- 🔄 Live Reload: Built-in development server with automatic page refresh
- 🗺️ Elegant Routing: Clean and expressive route definitions
- 🎮 MVC Architecture: Well-organized structure following MVC pattern
- 🔌 Database Layer: Simple PDO-based database abstraction
- ✨ Form Validation: Built-in validation system
- 🔒 Session Management: Secure session handling
- 🧩 View Components: Reusable UI components
- 💾 Caching System: Multiple cache drivers for performance
- 🛡️ Middleware System: Flexible request/response pipeline
- 🔧 CLI Tools: Command line interface for common tasks
📚 Documentation
Routing
// config/routes.php $router->get('/', 'HomeController@index'); $router->get('/users/{id}', 'UserController@show'); $router->post('/api/users', 'Api\UserController@store');
Controllers
namespace App\Controllers; use Blazer\Core\Controller; class HomeController extends Controller { public function index() { return $this->view('welcome', [ 'title' => 'Welcome to Blazer' ]); } }
Models
namespace App\Models; use Blazer\Core\Model; class User extends Model { protected static $table = 'users'; public static function findActive() { return static::where('status', 'active')->get(); } }
Database
// Using the DB class use Blazer\Core\Database\DB; // Run a query $users = DB::query("SELECT * FROM users WHERE active = ?", [true]); // Using models $activeUsers = User::where('active', true)->get(); $user = User::find(1);
Views
// In your controller return $this->view('users/profile', [ 'user' => $user, 'title' => 'User Profile' ]); // app/Views/users/profile.php <!DOCTYPE html> <html> <head> <title><?= $title ?></title> </head> <body> <h1>Welcome, <?= $user->name ?>!</h1> </body> </html>
🛠️ Development
Directory Structure
my-app/
├── app/
│ ├── Controllers/
│ ├── Models/
│ └── Views/
├── config/
│ ├── config.php
│ └── routes.php
├── public/
│ └── index.php
├── src/
│ └── Core/
├── storage/
│ ├── cache/
│ └── logs/
└── vendor/
Configuration
Copy .env.example
to .env
and update your settings:
APP_NAME=Blazer APP_ENV=local APP_DEBUG=true APP_URL=http://localhost:8000 DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_DATABASE=blazer DB_USERNAME=root DB_PASSWORD=
🤝 Contributing
We welcome contributions! Please feel free to submit a Pull Request.
📝 License
The Blazer Framework is open-sourced software licensed under the MIT license.
💖 Support
If you find Blazer helpful, please consider:
- Giving it a ⭐️ on GitHub
- Sharing it with friends and colleagues
- Contributing to the project
Made with ❤️ by Teck