PHP code example of ayouberrak / freamwork

1. Go to this page and download the library: Download ayouberrak/freamwork library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ayouberrak / freamwork example snippets


$router->get('/about', [PageController::class, 'about']);

// The {id} will be passed to the controller method
$router->get('/user/{id}', [UserController::class, 'show']);

$router->get('/', function() use ($router) {
    return $router->renderView('welcome');
});
bash
    php ayoub run
    
bash
php ayoub run
bash
php ayoub run 3000
bash
php ayoub make:controller UserController
bash
php ayoub make:controller ProductController
bash
php ayoub make:model Product
bash
php ayoub make:model User
bash
php ayoub make:service PaymentService
bash
php ayoub make:service AuthService
bash
php ayoub make:repository OrderRepository
bash
php ayoub make:repository UserRepository
bash
php ayoub make:route <method> <uri> <controller@action>
bash
# GET route
php ayoub make:route get /users UserController@index

# POST route
php ayoub make:route post /users/create UserController@store

# Dynamic route
php ayoub make:route get /users/{id} UserController@show

# DELETE route
php ayoub make:route delete /users/{id} UserController@destroy
bash
php ayoub route:list