PHPackages                             shaik-obydullah/lime-php-framework - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. shaik-obydullah/lime-php-framework

ActiveLibrary[Framework](/categories/framework)

shaik-obydullah/lime-php-framework
==================================

A lightweight PHP MVC framework

v1.0.0(1mo ago)00MITPHPPHP &gt;=8.1

Since Jul 10Pushed 2w agoCompare

[ Source](https://github.com/shaik-obydullah/lime-php-framework)[ Packagist](https://packagist.org/packages/shaik-obydullah/lime-php-framework)[ Docs](https://github.com/shaik-obydullah/lime-php-framework)[ RSS](/packages/shaik-obydullah-lime-php-framework/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Lime PHP Framework
==================

[](#lime-php-framework)

[![Latest Stable Version](https://camo.githubusercontent.com/70e79b1f6bf49be78d00d53f7d5bc86f412dba32482c265988693b449341d090/68747470733a2f2f706f7365722e707567782e6f72672f736861696b2d6f627964756c6c61682f6c696d652d7068702d6672616d65776f726b2f76)](https://packagist.org/packages/shaik-obydullah/lime-php-framework)[![License](https://camo.githubusercontent.com/849cc81f994ddc72eb1ac368d657c0684d371c13088663f9b24defe99a7bcf58/68747470733a2f2f706f7365722e707567782e6f72672f736861696b2d6f627964756c6c61682f6c696d652d7068702d6672616d65776f726b2f6c6963656e7365)](https://packagist.org/packages/shaik-obydullah/lime-php-framework)

[![PHP](https://camo.githubusercontent.com/8480157ff97d8f31ae2d2c2fc890173463fd875c8226f554ba3b648c470b732d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344253230382e312d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net/)[![MySQL](https://camo.githubusercontent.com/6ca779c3c93984e1977181e37adccf3c37deff3d1c55ee074ab1b9b7b4352aa7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d7953514c2d352e372532422d3434373941313f7374796c653d666c61742d737175617265266c6f676f3d6d7973716c266c6f676f436f6c6f723d7768697465)](https://www.mysql.com/)[![Dependencies](https://camo.githubusercontent.com/faf36b6d8dd0f65b6338cffbd9b52680ed60f0d53fa145f11cb546d8a3abe483/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d302d627269676874677265656e3f7374796c653d666c61742d737175617265)](composer.json)[![Version](https://camo.githubusercontent.com/f31ca375ffd11a199dbb51e75d8a9cdf2da894f221909fb4e48e8925d9f3fa3a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6672616d65776f726b2d76312e302e302d3633363666313f7374796c653d666c61742d737175617265)](System/Bootstrap.php)[![GitHub Stars](https://camo.githubusercontent.com/83830008f9115e4caaa6f1a586875adc99200d7b5e00ea0d970e36c45e8c7250/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f736861696b2d6f627964756c6c61682f6c696d652d7068702d6672616d65776f726b3f7374796c653d666c61742d737175617265)](https://github.com/shaik-obydullah/lime-php-framework)[![GitHub Forks](https://camo.githubusercontent.com/2ce97aad6c3fa323ccd669d79cdc8e5db9da6490318c02eb58c88c9511f8247f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f736861696b2d6f627964756c6c61682f6c696d652d7068702d6672616d65776f726b3f7374796c653d666c61742d737175617265)](https://github.com/shaik-obydullah/lime-php-framework)

A lightweight, minimal PHP MVC framework with routing, database abstraction, migrations, and a simple templating engine. Designed for small to medium web applications.

Packagist
---------

[](#packagist)

Available on [Packagist](https://packagist.org/packages/shaik-obydullah/lime-php-framework).

Documentation
-------------

[](#documentation)

- [User Guide](User-Guide.md)

Features
--------

[](#features)

- **MVC Architecture** – Clean separation of concerns with Controllers, Models, and Views
- **Simple Router** – Define routes with support for URL parameters (`{id}`), GET/POST/PUT/DELETE
- **Database Layer** – PDO-based query builder with prepared statements (MySQL)
- **Migration System** – Run SQL migration files from the command line
- **View Engine** – Plain PHP templates with data extraction
- **Autoloading** – PSR-4-like autoloading for `Lime\` and `App\` namespaces
- **Environment Config** – `.env` file support
- **CLI Tool** – `php lime` for running migrations
- **JSON &amp; Redirect Helpers** – Built into the base Controller

Requirements
------------

[](#requirements)

- PHP 8.1+
- MySQL 5.7+ / MariaDB 10.2+
- Composer (for third-party dependencies)
- Apache mod\_rewrite (or nginx equivalent)

Installation
------------

[](#installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

```
composer create-project shaik-obydullah/lime-php-framework my-app
```

### Manual Installation

[](#manual-installation)

```
mkdir my-app && cd my-app
```

Copy the contents of this repository into your project root:

```
my-app/
├── App/
│   ├── Controller/
│   ├── Database/
│   │   └── Migrations/
│   ├── Router/
│   │   └── web.php
│   └── View/
├── Public/
│   ├── index.php
│   └── .htaccess
├── System/
│   ├── Bootstrap.php
│   ├── Controller.php
│   ├── Database.php
│   ├── Migration.php
│   ├── Model.php
│   ├── Router.php
│   └── View.php
├── storage/
├── .env
├── .htaccess
├── composer.json
└── lime

```

### 2. Install dependencies

[](#2-install-dependencies)

```
composer install
```

### 3. Configure environment

[](#3-configure-environment)

Copy `.env` and set your database credentials:

```
DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=my_database
DB_USER=root
DB_PASS=secret
APP_KEY=your-32-char-secret-key
```

### 4. Run migrations

[](#4-run-migrations)

```
php lime migrate
```

### 5. Serve the application

[](#5-serve-the-application)

```
php -S localhost:8000 -t Public
```

Point your browser to `http://localhost:8000`.

Directory Structure
-------------------

[](#directory-structure)

```
├── App/                    # Application code
│   ├── Controller/         # Controllers (e.g., HomeController.php)
│   ├── Database/
│   │   └── Migrations/     # SQL migration files (e.g., 001_create_users.sql)
│   ├── Model/              # Model classes (optional)
│   ├── Router/
│   │   └── web.php         # Route definitions
│   └── View/               # PHP view templates
├── Public/                 # Web root
│   ├── index.php           # Front controller (entry point)
│   ├── style.css           # Static assets
│   └── .htaccess           # URL rewriting rules
├── System/                 # Framework core (Lime namespace)
│   ├── Bootstrap.php       # Autoloader, env loader, constants
│   ├── Controller.php      # Base controller class
│   ├── Database.php        # Database connection & helpers
│   ├── Migration.php       # Migration runner
│   ├── Model.php           # Base model class
│   ├── Router.php          # Route matching & dispatching
│   └── View.php            # View renderer
├── storage/                # Writable file storage
├── vendor/                 # Composer dependencies
├── .env                    # Environment variables (git-ignore this)
├── .htaccess               # Root-level rewrite rules
├── composer.json           # Composer config
└── lime                    # CLI entry point

```

Routing
-------

[](#routing)

Define routes in `App/Router/web.php`:

```
use Lime\Router;

Router::get('/', 'HomeController@index');
Router::post('/login', 'AuthController@login');
Router::match(['GET', 'POST'], '/register', 'AuthController@register');
Router::get('/user/{id}', 'UserController@show');
```

### Available methods

[](#available-methods)

MethodDescription`Router::get($uri, $handler)`Register a GET route`Router::post($uri, $handler)`Register a POST route`Router::match($methods, $uri, $handler)`Register for multiple HTTP methodsRoute handlers follow the format: `ControllerName@methodName`

### URL Parameters

[](#url-parameters)

Parameters are defined with curly braces and passed as method arguments:

```
// Route: /user/{id}
Router::get('/user/{id}', 'UserController@show');

// Controller
class UserController extends Controller
{
    public function show(string $id): void
    {
        // $id is extracted from the URL
    }
}
```

Controllers
-----------

[](#controllers)

Controllers extend `Lime\Controller` and are placed in `App/Controller/` under the `App\Controller` namespace.

```
