PHP code example of phpzm / simples

1. Go to this page and download the library: Download phpzm/simples 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/ */

    

phpzm / simples example snippets



    (...)
    'resources' => [
        'root' => 'app/resources',
    ]
    (...)


    (...)
    'files' => [
        'app/routes/index.php'
    ]
    (...)

return function($router) {

    $router->on('GET', '/', function() {
       return 'Hello World!';
    });
}

return function($router) {

    $router->get('/:controller/:method', function($controller, $method) {
       return 'Hello World!';
    });
}

return function($router) {

    // lista com arquivos de rota
    $router->group('GET', '/site', ['more/files/routes.php', 'more/files/site.php']);

    // pasta que contém arquivos de rotas
    $router->group('*', '/api', 'api/routes');
}

return function($router) {

    $router->post('/client/save', '\Namespace\ClientController@save');
    $router->resource('client', '\Namespace\ClientController');
}