PHP code example of skyline / api

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

    

skyline / api example snippets


use Skyline\API\Controller\AbstractAPIActionController;
use Symfony\Component\HttpFoundation\Request;
use Skyline\Kernel\Service\CORSService;

class MyAPIActionController extends AbstractAPIActionController {
    // Routing to the action is done by default in the
    // routing configuration or annotation compiler
    public function myAction() {
        // ...
    }
    
    // But this action gets only performed if ...
    public function acceptsAnonymousRequest(Request $request): bool
    {
        // ... the request has an origin header field or
        return SkyGetRunModes() > SKY_RUNMODE_PRODUCTION;
    }
    
    public function acceptsCrossOriginRequest(Request $request): bool
    {
        // ... the request came from the same origin or
        return CORSService::isRegistered( $request->getHost() );
    }
    
    public function acceptOrigin(Request $request, bool &$