PHPackages                             akbaraditamasp/lego-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. akbaraditamasp/lego-framework

ActiveProject[Framework](/categories/framework)

akbaraditamasp/lego-framework
=============================

Like lego, this framework is built by combining several php libraries.

041PHP

Since Nov 1Pushed 3y ago1 watchersCompare

[ Source](https://github.com/akbaraditamasp/lego-framework)[ Packagist](https://packagist.org/packages/akbaraditamasp/lego-framework)[ RSS](/packages/akbaraditamasp-lego-framework/feed)WikiDiscussions main Synced 1mo ago

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

LEGO FRAMEWORK
==============

[](#lego-framework)

PHP Framework built from a combination of several libraries.

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

[](#installation)

`composer create-project akbaraditamasp/lego-framework:dev-main example-app`

Then run the following command in the terminal to start the localhost web server.

`php adel run`

Routing
-------

[](#routing)

The route file is in `public/index.php`

Routing in Lego uses the [bramus/router](https://github.com/bramus/router) library. Below is a simple example.

```
    $app->route("GET", "/", function() {
        return ["message" => "Hello World!"];
    });
```

The route handler can also reference a controller method.

```
    $app->route("GET", "/", "Controller\\Welcome::index");
```

For more details, please visit the documentation from [bramus/router](https://github.com/bramus/router).

Controller
----------

[](#controller)

Controllers are the de facto way of handling HTTP requests in Lego. They enable you to clean up the routes file by moving all the inline route handlers to their dedicated controller files.

In Lego, the controllers are stored inside (but not limited to) the `controllers/` directory and each file represents a single controller. For example:

```
