This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function csv_to_array(string $file, string $delimiter = ';'): array | |
{ | |
if (!file_exists($file)) { | |
throw new InvalidArgumentException("File '{$file}' not found"); | |
} | |
$titles = $content = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// src/Command/ExportSwaggerCommand.php | |
namespace App\Command; | |
use Nelmio\ApiDocBundle\ApiDocGenerator; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\{InputArgument, InputInterface}; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Style\SymfonyStyle; | |
use Symfony\Component\Yaml\Yaml; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controller\Api; | |
use App\Collection\CinemaCollection; | |
use FOS\RestBundle\Controller\{AbstractFOSRestController, Annotations as Rest}; | |
use FOS\RestBundle\View\View; | |
use Nelmio\ApiDocBundle\Annotation\{Model, Security}; | |
use OpenApi\Annotations as OA; | |
use Symfony\Component\HttpFoundation\Request; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// src/Controller/Api/CinemaController.php | |
namespace App\Controller\Api; | |
use App\Collection\CinemaCollection; | |
use FOS\RestBundle\Controller\{AbstractFOSRestController, Annotations as Rest}; | |
use FOS\RestBundle\View\View; | |
use Nelmio\ApiDocBundle\Annotation\{Model, Security}; | |
use OpenApi\Annotations as OA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/packages/fos_rest.yaml | |
# Documentation: https://symfony.com/doc/master/bundles/FOSRestBundle/ | |
fos_rest: | |
routing_loader: false | |
view: | |
view_response_listener: 'force' | |
formats: | |
json: true | |
xml: true | |
zone: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// src/DataFixtures/AppFixtures.php | |
namespace App\DataFixtures; | |
use App\DataFixtures\ORM\AppNativeLoader; | |
use Doctrine\Bundle\FixturesBundle\Fixture; | |
use Doctrine\Persistence\ObjectManager; | |
class AppFixtures extends Fixture | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpClient\HttpClient; | |
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; | |
// Complete configuration: https://hcaptcha.com | |
const HCAPTCHA_SECRET_KEY = '...'; | |
const HCAPTCHA_API_KEY = '...'; | |
/** | |
* @throws Exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
const TEST_KEY = 'are_we_glued'; | |
const REDIS_HOST = 'localhost'; | |
const REDIS_PORT = 6379; | |
$redis = new Redis; | |
try { | |
$redis->connect(REDIS_HOST, REDIS_PORT); | |
$redis->set(TEST_KEY, 'yes'); | |
$glueStatus = $redis->get(TEST_KEY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = <<<'GRAPHQL' | |
query GetUser($user: String!) { | |
user (login: $user) { | |
name | |
repositoriesContributedTo { | |
totalCount | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. First route: Get data and index them in Postman Variable | |
// Set this content in Request > "Tests" Tab | |
// Step: You can get barcode with Sale > Get by ID | |
var jsonData = JSON.parse(responseBody); | |
if (jsonData.data.idSale) { | |
postman.setEnvironmentVariable("saleId", jsonData.data.idSale); | |
} |
OlderNewer