1. Go to this page and download the library: Download erdum/php-weekend 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/ */
erdum / php-weekend example snippets
e(__DIR__ . '/src/Router.php');
use PhpWeekend\Router;
use PhpWeekend\App;
Router::get('/', function() {
App::send_json(array('data' => 'Hello, World!'));
});
Router::get('/simple', function() {
App::send_response('This is the content.', 200, 'text/html');
});
Router::get('/get_pdf', function() {
App::send_file(__DIR__ . '/static/my_file.pdf');
});
hpWeekend\Router;
use PhpWeekend\App;
Router::get('/', function() {
App::send_json(['data' => 'Hello, World!']);
});
/*
Router also have
post
put
patch
delete
any
*/