omegamvc / omega
Omega is a lightweight PHP framework designed for building modern web applications using the MVC architecture. Compatible with PHP 8.2+.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^8.4
- ext-apcu: *
- ext-http: *
- ext-iconv: *
- ext-mbstring: *
- ext-openssl: *
- ext-pcntl: *
- ext-posix: *
- ext-readline: *
- ext-simplexml: *
- omegamvc/framework: ^2.0.0
- react/event-loop: ^1.5
- vlucas/phpdotenv: ^5.6
Requires (Dev)
- filp/whoops: ^2.18
- squizlabs/php_codesniffer: ^3.11
README
Documentation | Changelog | Contributing | Code Of Conduct | License
Omega Starter Application
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.
Feature
- MVC structure
- Application Container (power with php-di)
- Router Support
- Models builder
- Query builder
- CLI command
- Service Provider and Middleware
- Templator (template engine)
Getting Started in 4 Simple Steps
Create Your Application:
composer create-project omegamvc/omega project-name
Navigate to Your Project:
cd project-name
Build Your Assets:
npm install npm run build
Serve Your Application:
php cli serve
Additional Features ✨
CLI Commands for Building Your App
# Create migration schema php cli make:migration profiles php cli db:create # skip if database already exists php cli migrate # Create a model php cli make:model Profile --table-name profiles # Create controller (or API services) php cli make:controller Profile php cli make:services Profile # Presenter for HTML response php cli make:view profile
Example Code Snippets
Migration Schema
// database/migration/<timestamp>_profile.php Schema::table('profiles', function (Create $column) { $column('user')->varChar(32); $column('real_name')->varChar(100); $column->primaryKey('user'); });
Controller
// app/Controller/ProfileController.php public function index(MyPDO $pdo): Response { return view('profiles', [ 'name' => Profile::find('YOU_NAME', $pdo)->real_name ]); }
Services (rest api out of the box)
Api ready to go http://localhost:8080/api/profile/index
.
// app/services/ProfileServices.php public function index(MyPDO $pdo): array { return [ 'name' => Profile::find('YOUR_NAME', $pdo)->real_name, 'status' => 200, 'header' => [] ]; }
View
// resources/views/profile.template.php {% extend('base/base.template.php') %} {% section('title', 'hay {{ $name }}') %} {% section('content') %} <p>{{ $name }}</p> {% endsection %}
Router Configuration
// route/web.php Router::get('/profile', Profile::class);
Optimize
Optimize by cached Application.
# cache view compiler php cli view:cache # cache application config php cli config:cache
Official Documentation
The official documentation for Omega is available here
Contributing
If you'd like to contribute to the Omega example application package, please follow our contribution guidelines.
License
This project is open-source software licensed under the GNU General Public License v3.0.