PHP code example of dynamikaweb / yii2-citta-api

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

    

dynamikaweb / yii2-citta-api example snippets


use dynamikaweb\api\CittaApi;

class DemoController extends MyBaseController
{
    public function actionIndex($unidade, $exercicio)
    {   
        // set url api
        CittaApi::setBaseUrl("https://example.com");

        // make requests
        $categorias = CittaApi::findAll(['orgaos', 
            'unidadeGestora' => $unidade,
            'exercicio' => $exercicio
        ]);

        $anos = CittaApi::cacheFindAll(['ano/filtros']);
        
        // return response data
        return $this->render('index', [
            'categorias' => $categoria,
            'anos' => $anos
        ]);
    }
}