Skip to content

Instantly share code, notes, and snippets.

View jgauthi's full-sized avatar

jgauthi

  • France
View GitHub Profile
@jgauthi
jgauthi / ExportSwaggerCommand.php
Last active April 5, 2021 14:25
[Symfony] Export Apidoc to YAML File
<?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;
@jgauthi
jgauthi / csv_to_array.php
Last active November 8, 2024 10:31
Convert CSV File to php array
<?php
function csv_to_array(string $file, ?string $key_line = null, string $delimiter = ',', string $enclosure = ''): array
{
if (!is_readable($file)) {
throw new \InvalidArgumentException("The file {$file} doesn't exists or not readable.");
}
$titles = $content = [];