PHP code example of spiechu / symfony-commons-bundle
1. Go to this page and download the library: Download spiechu/symfony-commons-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/ */
spiechu / symfony-commons-bundle example snippets
// src/AppBundle/Controller/AdminController.php
use Spiechu\SymfonyCommonsBundle\Annotation\Controller\ResponseSchemaValidator;
class AdminController extends Controller
{
/**
* @Route("/", name="my_route")
*
* @ResponseSchemaValidator(
* json={
* 200="@AppBundle/Resources/response_schema/my_route_200.json",
* 500="@AppBundle/Resources/response_schema/my_route_500.json"
* }
* )
*/
public function indexAction(): Response
{
// ...
}
}
// src/AppBundle/Controller/V1_0/UserController.php
use Spiechu\SymfonyCommonsBundle\Annotation\Controller\ApiVersion;
/**
* @ApiVersion("1.0")
*/
class UserController extends Controller
{
/**
* @Route("/", name="my_route")
*/
public function indexAction(): Response
{
// ...
}
}
// src/AppBundle/Controller/V1_1/UserController.php
use Spiechu\SymfonyCommonsBundle\Annotation\Controller\ApiVersion;
use Spiechu\SymfonyCommonsBundle\Controller\V1_0\UserController as BaseUserController;
/**
* @ApiVersion("1.1")
*/
class UserController extends BaseUserController
{
/**
* @Route("/", name="my_route")
*/
public function indexAction(): Response
{
// ...
}
}
// app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
// ...
new Spiechu\SymfonyCommonsBundle\SpiechuSymfonyCommonsBundle(),
];
// ...
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.