PHP code example of appaydin / pd-api

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

    

appaydin / pd-api example snippets



// config/bundles.php

return [
    //...
    Pd\ApiBundle\PdApiBundle::class => ['all' => true]
];

# src/Controller/AuthorizationController.php

namespace App\Controller;

use Pd\ApiBundle\Controller\AbstractApiController;
use Pd\ApiBundle\Controller\LoginTrait;

class AuthorizationController extends AbstractApiController
{
    use LoginTrait;
}

# src/Controller/ExampleApiController.php

use Pd\ApiBundle\Controller\AbstractApiController;
use Symfony\Component\Routing\Annotation\Route;

class ExampleApiController extends AbstractApiController
{
    #[Route("/home", name:"api.home", methods: ["GET"])]
    public function home() {
        return ['test'];
    }
}