1. Go to this page and download the library: Download sml/sml-frame 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/ */
sml / sml-frame example snippets
$app = new Sml\Sml();
# Run the application
$app->run();
$app = new Sml\Sml();
$app::get('/', function(){
echo 'test';
});
# If you want to pass arguments to the function you do this with regEx values
# Supported values are for Strings and Ints
# String and int value
$app::get('/user/(\w+)/(\d+)', function( $string, $int ){
# You can then use the params here
});
# POST
$app::post('/user', function() use( $app ) {
# To get the post request you can do:
# This recives a json encoded body for you, and returns as obj.
# If you want a array you can pass true into the json( true )
$app->request()->json();
# This recives the x-www-form-urlencoded body ( normal POST )
$app->request()->body();
});
# Run the application
$app->run();
$app = new Sml\Sml();
$app::get('/', function() use( $app ){
$app->response( 200, "it Works" )->send();
});
# You can also send back json_response by chaining the sendJson method onto the response method.
$app::get('/', function() use( $app ){
$app->response( 200, "it Works" )->sendJson();
});
$app->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.