PHP code example of grzegorz-jamroz / sf-api-bundle
1. Go to this page and download the library: Download grzegorz-jamroz/sf-api-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/ */
grzegorz-jamroz / sf-api-bundle example snippets
declare(strict_types=1);
namespace App\Action\Product;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
#[Route('/product/promotion', name: 'product_promotion', methods: ['POST'])]
class PromoteAction
{
public function __invoke(): Response
{
return new JsonResponse(['message' => 'product promotion']);
}
}
shell
------------------- -------- -------- ------ -----------------------------------
Name Method Scheme Host Path
------------------- -------- -------- ------ -----------------------------------
product_promotion POST ANY ANY /product/promotion
------------------- -------- -------- ------ -----------------------------------