PHP code example of nafisc / synful
1. Go to this page and download the library: Download nafisc/synful 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/ */
nafisc / synful example snippets
namespace App\RequestHandlers;
use \Synful\Framework\RequestHandler;
use \Synful\Framework\Request;
/**
* Example RequestHandler.
*/
class GetIPExample extends RequestHandler
{
/**
* Override the handler endpoint
* Example: http://myapi.net/user/search
* uses the endpoint `user/search`.
*
* @var string
*/
public $endpoint = 'example/getip';
/**
* Handles a GET request type.
*
* @param \Synful\Framework\Request $request
* @return \Synful\Framework\Response|array
*/
public function get(Request $request)
{
return [
'ip' => $request->ip,
];
}
}