Skip to content

Instantly share code, notes, and snippets.

View lsv's full-sized avatar

Martin Århof lsv

View GitHub Profile
@lsv
lsv / CarbonCommand.php
Last active August 18, 2024 13:57
symfony carbon normalizer
<?php
namespace App\Command;
use Carbon\Carbon;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Serializer\SerializerInterface;
@lsv
lsv / symfony-deserialize.php
Last active August 13, 2019 07:54
is it possible to use ArrayDenormalizer, ObjectNormalizer and GetSetMethodNormalizer together?
<?php
// composer require symfony/serializer symfony/property-info symfony/property-access phpdocumentor/reflection-docblock
require __DIR__ . '/vendor/autoload.php';
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
@lsv
lsv / README.md
Last active May 4, 2024 17:05
KNP Menu Bundle - Bootstrap 4 and Font Awesome 4
@lsv
lsv / Menu.php
Last active January 11, 2020 10:40
Symfony 4 - KnpMenuBundle - menu with event
<?php
// src/Menu/Menu.php
namespace App\Menu;
use App\Event\Menu\Topbar\UserMenuEvent;
use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RequestStack;
@lsv
lsv / settings.json
Created June 21, 2017 03:39
visualstudio code settings
{
"editor.renderIndentGuides": false,
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "Dracula",
"files.autoSave": "onFocusChange",
"editor.fontSize": 18,
"workbench.tips.enabled": false,
"workbench.welcome.enabled": false,
"npm-intellisense.scanDevDependencies": true,
"beautify.language": {