Documentation | Changelog | Contributing | Code Of Conduct | License
Welcome to omega, a minimal MVC framework designed to streamline your PHP development process. This lightweight framework offers essential features for building web applications while maintaining simplicity and ease of use.
- MVC structure
- Application Container (power with php-di)
- Router Support
- Models builder
- Query builder
- CLI command
- Service Provider and Middleware
- Templator (template engine)
composer create-project omegamvc/omega project-namecd project-namenpm install
npm run buildphp omega serveThat's it! Your app is now running. Let's build something awesome.
We'll create a user profile feature from scratch.
php omega make:migration profiles
php omega db:create # Only if database doesn't exist yetDefine your table structure:
// database/migration/<timestamp>_profiles.php
Schema::table('profiles', function (Create $column) {
$column('user')->varChar(32);
$column('real_name')->varChar(100);
$column->primaryKey('user');
})Run the migration:
php omega migratephp omega make:model Profile --table-name profilesphp omega make:controller ProfileAdd your logic:
// app/Controller/ProfileController.php
public function handle(MyPDO $pdo): Response
{
return view('profile', [
'name' => Profile::find('omegamvc', $pdo)->real_name
]);
}php omega make:view profile// resources/views/profile.template.php
{% extend('base/base.template.php') %}
{% section('title', 'Welcome {{ $name }}') %}
{% section('content') %}
<h1>Hello, {{ $name }}! 👋</h1>
{% endsection %}// route/web.php
Router::get('/profile', [ProfileController::class, 'index']);Done! Visit /profile and see your work in action.
Skip the route files entirely. Use attributes for clean, self-documented APIs:
php omega make:services Profile// app/Services/ProfileServices.php
#[Get('/api/v1/profile')]
#[Name('api.v1.profile')]
#[Middleware([AuthMiddleware::class])]
public function index(MyPDO $pdo): array
{
$data = Cache::remember('profile', 3600, fn () => [
'name' => Profile::find('omegamvc', $pdo)->real_name,
'status' => 200,
]);
return JsonResponse($data);
}then register this route attribute.
Router::register([
ProfileServices::class,
// add more class
]);This automatically creates your route with middleware—no extra configuration needed!
Equivalent traditional route:
Route::get('/api/v1/profile', [ProfileServices::class, 'index'])
->name('api.v1.profile')
->middleware([AuthMiddleware::class]);Ready for production? Cache everything:
php omegamvc view:cache # Cache compiled templates
php omegamvc config:cache # Cache configuration
php omegamvc route:cache # Cache all routesThe official documentation for Omega is available here
If you'd like to contribute to the Omega example application package, please follow our contribution guidelines.
This project is open-source software licensed under the GNU General Public License v3.0.