PHP code example of qpautrat / woohoolabs-yin-bundle

1. Go to this page and download the library: Download qpautrat/woohoolabs-yin-bundle 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/ */

    

qpautrat / woohoolabs-yin-bundle example snippets


public function registerBundles()
{
    $bundles = array(
        // ...

        new QP\WoohoolabsYinBundle\QPWoohoolabsYinBundle(),
    );

    // ...
}

namespace App\Controller;

use Psr\Http\Message\ResponseInterface;
use WoohooLabs\Yin\JsonApi\JsonApi;

class DefaultController
{
    /**
     * @var JsonApi
     */
    private $jsonApi;

    public function __construct(JsonApi $jsonApi)
    {
        $this->jsonApi = $jsonApi;
    }

    public function index(): ResponseInterface
    {
        return $this->jsonApi->respond()->ok(new HelloDocument(), 'hello');
    }
}

namespace App\Controller;

use Psr\Http\Message\ResponseInterface;
use WoohooLabs\Yin\JsonApi\JsonApi;

class DefaultController
{
    public function index(JsonApi $jsonApi): ResponseInterface
    {
        return $jsonApi->respond()->ok(new HelloDocument(), 'hello');
    }
}