A Lightweight, Modern PHP Framework for Rapid Development
OxygenFramework is a lightweight, modern PHP framework designed for developers who want the power of a full-featured framework without the bloat. Built with simplicity and performance in mind, Oxygen provides all the essential tools you need to build web applications quickly and efficiently.
Created by: REDWAN AOUNI
- Simple Routing - Clean, expressive routing with support for GET, POST, PUT, DELETE, PATCH
- Elegant ORM - Active Record pattern with relationships, pagination, and query building
- Twig Templates - Powerful templating engine with inheritance and components
- Authentication - Built-in session-based authentication system
- Security - CSRF protection, XSS prevention, and SQL injection protection
- Dependency Injection - Service container for clean, testable code
- Middleware - Global and route-specific middleware support
- CLI Tools - Powerful command-line interface for scaffolding and management
- Code Generators - Generate models, controllers, migrations, and complete CRUD scaffolds
- Database Migrations - Version control for your database schema
- Query Builder - Fluent interface for building database queries
- Localization - Multi-language support with RTL compatibility
- File Storage - Simple file upload and storage management
- Validation - Built-in validation for forms and API requests
- Logging - Comprehensive logging system
- Configuration - Environment-based configuration management
- PHP 7.4 or higher
- Composer
- MySQL/MariaDB or SQLite
- Apache/Nginx with mod_rewrite
# Clone the repository
git clone https://github.com/aouniradouan/oxygen-framework.git
cd oxygen-framework
# Install dependencies
composer install
# Configure environment
copy .env.example .env
# Edit .env with your database credentials
# Then run the development server
php oxygen serveVisit http://localhost:8000
Edit routes/web.php:
<?php
use Bramus\Router\Router;
use Oxygen\Core\Route;
$router = app()->make(Router::class);
// Simple route
Route::get($router, '/', function() {
echo view('welcome');
});
// Route with controller
Route::get($router, '/users', 'UserController@index');# Generate a model
php oxygen make:model Post
# Generate model with migration
php oxygen make:model Post --migration<?php
namespace Oxygen\Models;
use Oxygen\Core\Model;
class Post extends Model
{
protected $table = 'posts';
protected $fillable = ['title', 'content', 'user_id'];
public function user()
{
return $this->belongsTo(User::class);
}
}// Create
$post = Post::create([
'title' => 'My First Post',
'content' => 'Hello World!',
'user_id' => 1
]);
// Read
$posts = Post::all();
$post = Post::find(1);
$posts = Post::where('user_id', '=', 1)->get();
// Update
Post::update(1, ['title' => 'Updated Title']);
// Delete
Post::delete(1);
// With relationships
$posts = Post::with('user')->get();- Routing - Define routes and handle requests
- Controllers - Organize your application logic
- Models & Database - Work with databases
- Views & Templates - Render beautiful interfaces
- Middleware - Filter HTTP requests
- CLI Commands - Command-line tools and generators
- Authentication - User authentication and authorization
- Error Handling - Handle errors gracefully
- Localization - Multi-language support
- API Development - Build RESTful APIs
- Helper Functions - Available helper functions
- Configuration Reference - All configuration options
# Serve the application
php oxygen serve
# Generate resources
php oxygen make:model User
php oxygen make:controller UserController
php oxygen make:mvc Post # Model + Controller + Views
# Database migrations
php oxygen make:migration create_users_table
php oxygen migrate
php oxygen migrate:rollback
# Other commands
php oxygen list # List all commands
php oxygen queue:work # Process queued jobs
php oxygen schedule:run # Run scheduled tasksoxygen-framework/
├── app/
│ ├── Console/ # CLI commands
│ ├── Controllers/ # Application controllers
│ ├── Core/ # Framework core
│ ├── Models/ # Database models
│ ├── Middleware/ # HTTP middleware
│ └── helpers/ # Helper functions
├── config/ # Configuration files
├── database/
│ └── migrations/ # Database migrations
├── public/ # Public assets
│ └── index.php # Entry point
├── resources/
│ └── views/ # Twig templates
├── routes/
│ ├── web.php # Web routes
│ └── api.php # API routes
├── storage/ # File storage & logs
└── vendor/ # Composer dependencies
# Generate everything you need
php oxygen make:mvc Article
# This creates:
# - Model: app/Models/Article.php
# - Controller: app/Controllers/ArticleController.php
# - Views: resources/views/articles/{index,create,edit,show}.twig.html
# - Migration: database/migrations/xxxx_create_articles_table.phpRun the migration:
php oxygen migrateAdd routes in routes/web.php:
Route::resource($router, '/articles', 'ArticleController');That's it! You now have a fully functional CRUD interface for articles.
OxygenFramework is built on these principles:
- Simplicity First - Easy to learn, easy to use
- Convention over Configuration - Sensible defaults that just work
- Developer Happiness - Tools that make development enjoyable
- Performance - Lightweight core, fast execution
- Flexibility - Extend and customize as needed
We welcome contributions! Please see CONTRIBUTING.md for details.
git clone https://github.com/redwan-aouni/oxygen-framework.git
cd oxygen-framework
composer install
copy .env.example .env
php oxygen serveIf you discover a security vulnerability, please email aouniradouan@gmail.com. All security vulnerabilities will be promptly addressed.
OxygenFramework is open-sourced software licensed under the MIT license.
Created by: REDWAN AOUNI
Email: aouniradouan@gmail.com
Location: Algeria 🇩🇿
- Bramus Router - Routing
- Twig - Templating
- Nette Database - Database layer
- Whoops - Error handling (dev mode)
Made with care in Algeria