PHP code example of zulfajuniadi / tinyrest

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

    

zulfajuniadi / tinyrest example snippets


new Tinyrest\Handle(['projects', 'todos']);

    $TinyRest = new Tinyrest\Handle(['projects', 'todos'], '../data/');
    $projects = $TinyRest->router('projects');
    
    // Do something when a new project is created
    $listener_id = $projects->on('create', function($new_data){
        // Log $new_data creation
    });
    
    // To stop listening to the event
    $projects->off('create', $listener_id);

new Tinyrest\Handle(['projects', 'todos'], '../data/');