PHP code example of r-odriguez / tusk

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

    

r-odriguez / tusk example snippets


const BASE_PATH = __DIR__ . '/../';

const BASE_PATH = __DIR__ . '/../';
 import function can import an entire directory (only php files)

const route = new tusk\Route();
route->redirect(from: '/', to: '/home')
route->path('/home', '/home.php')
     ->path('/user/:age(number)', '/user/') // you can chain them

// use the Middleware abstract class to provide security. Look for the Middleware.php file so you
// know how it looks.
// MyAuthMiddle::class is defined inside ./src/middlewares/.
route->pathM('/user/:name(word)/profile', '/user/profile.php', MyAuthMiddle::class);

    const route = new Route(URL['path']);
    route->path('/obj/:name(word)/section', 'web/obj/section/')
         ->path('/api/obj/:name(word)/props', 'api/obj/props.php')
         ->path('/api/obj/:name(word)/prop/:name(word)', 'api/obj/prop_name.php')
    
makefile
all: run

run:
	@echo "starting server..."
	@php -S localhost:8080 -t ./public/ --php-ini=./php.ini

# add more stuff as you go