PHP code example of retamayo / vector

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

    

retamayo / vector example snippets




use Retamayo\Vector\Vector;

$vector = Vector::getInstance();

$vector->run();

// add static routes
$this->get('/route_name', 'path_to_file');

// add callback routes
$this->get('/route_name', function () {
    echo "Hello World!";
});

// add dynamic routes
$this->get('/route_name/{slug}', function ($slug) {
    echo "Hello " . $slug;
});

define('DEFAULT_404', 'path_you_like');