PHP code example of ad3n / client-platform

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

    

ad3n / client-platform example snippets




namespace App;

use Ihsan\Client\Platform\Bootstrap;
use Psr\Cache\CacheItemPoolInterface;

class Application extends Bootstrap
{
    /**
     * @param string $configDir
     * @param CacheItemPoolInterface|null $cachePool
     * @param array $values
     */
    public function __construct($configDir, CacheItemPoolInterface $cachePool = null, array $values = array())
    {
        parent::__construct($cachePool, $values);
        $this->boot($configDir);
    }

    /**
     * @return string
     */
    protected function projectDir()
    {
        return __DIR__.'/..';
    }
}




pp\Application;
use Symfony\Component\HttpFoundation\Request;

$configDir = __DIR__.'/../app/config';

$request = Request::createFromGlobals();

$app = new Application();
$app->boot($configDir);
$app->handle($request);




namespace App\Controller;

use Ihsan\Client\Platform\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;

class HomeController extends AbstractController
{
    public function indexAction()
    {
        //$this->get('url', $args);
        //$this->post('url', $args);
        //$this->put('url', $args);
        //$this->delete('url', $args);
        //$this->client
        //Client is instance of \Ihsan\Client\Platform\Api\ClientInterface
        //$this->renderResponse('view_name', $viewArgs);
        
        return new Response('Hello World!.');
    }
}