# swallowphp-framework **Repository Path**: wfdaj/swallowphp-framework ## Basic Information - **Project Name**: swallowphp-framework - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-23 - **Last Updated**: 2025-12-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SwallowPHP Framework A lightweight, modern PHP framework designed for simplicity and rapid development. SwallowPHP provides essential features for building web applications without the complexity of larger frameworks. [](https://opensource.org/licenses/MIT) [](https://php.net) [](https://github.com/swallowphp/framework) ## Features - **Dependency Injection** - Built on [League Container](https://container.thephpleague.com/) with auto-wiring support - **Fluent Query Builder** - Intuitive database operations with PDO - **Eloquent-style ORM** - Active Record pattern with relationships and events - **Routing** - Simple, expressive route definitions with middleware support - **Authentication** - Built-in authentication with remember me and brute-force protection - **Session Management** - File-based sessions with flash messages - **Caching** - PSR-16 compatible caching (file, SQLite drivers) - **Logging** - PSR-3 compatible file-based logging - **CSRF Protection** - Automatic cross-site request forgery protection - **Rate Limiting** - Per-route request rate limiting ## Requirements - PHP 8.0 or higher - PDO extension (for database) - JSON extension - mbstring extension ## Installation Install via Composer: ```bash composer require swallowphp/framework ``` ## Quick Start ### 1. Create Entry Point Create a `public/index.php` file: ```php env('APP_NAME', 'SwallowPHP'), 'env' => env('APP_ENV', 'production'), 'debug' => (bool) env('APP_DEBUG', false), 'url' => env('APP_URL', 'http://localhost'), 'timezone' => 'UTC', 'locale' => 'en', 'key' => env('APP_KEY'), 'storage_path' => BASE_PATH . '/storage', 'view_path' => BASE_PATH . '/resources/views', 'controller_namespace' => '\\App\\Controllers', ]; ``` ### 4. Define Routes Create `routes/web.php`: ```php name('home'); // Route with parameter Router::get('/users/{id}', function (Request $request) { return 'User ID: ' . $request->get('id'); })->name('users.show'); // Controller route Router::get('/posts', [App\Controllers\PostController::class, 'index']) ->name('posts.index'); Router::post('/posts', [App\Controllers\PostController::class, 'store']) ->name('posts.store'); ``` ### 5. Create a Controller Create `app/Controllers/PostController.php`: ```php get(); return view('posts.index', ['posts' => $posts]); } public function store(Request $request) { \App\Models\Post::create([ 'title' => $request->get('title'), 'content' => $request->get('content'), ]); return redirectToRoute('posts.index'); } } ``` ### 6. Create a Model Create `app/Models/Post.php`: ```php