Skip to content

Instantly share code, notes, and snippets.

View faizanakram99's full-sized avatar
💭
PHPing(SYMFONYing) all the time

Faizan Akram Dar faizanakram99

💭
PHPing(SYMFONYing) all the time
View GitHub Profile
@faizanakram99
faizanakram99 / AbstractTranslationRepository.php
Last active February 26, 2024 17:12
Single entity with multiple entity manager (a real production code example)
<?php
declare(strict_types=1);
namespace Tld\Translation\Infrastructure\Doctrine\Repository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Tld\Translation\Domain\Entity\Translation;
@faizanakram99
faizanakram99 / QueryHydrator.php
Created January 20, 2024 00:15
DBAL results to object hydrator
<?php
declare(strict_types=1);
namespace HakunaMatata;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Query\QueryBuilder;
use Doctrine\DBAL\Types\Type;
@faizanakram99
faizanakram99 / TranslationConfigCacheFactory.php
Created June 30, 2022 16:09
Example of ConfigCacheFactory for overriding translation cache for multi-tenant app with tenant specific translations
<?php
namespace Yup\Translation;
use Symfony\Component\Config\ConfigCacheFactoryInterface;
use Symfony\Component\Config\ConfigCacheInterface;
class TranslationConfigCacheFactory implements ConfigCacheFactoryInterface
{
private ConfigCacheFactoryInterface $configCacheFactory;
@faizanakram99
faizanakram99 / MonospaceResponse.php
Created November 18, 2020 12:02
View Monolog in browser with HttpFoundation component
<?php
declare(strict_types=1);
namespace Qbil\CommonBundle\Extension;
use Symfony\Component\HttpFoundation\Response;
use Webmozart\Assert\Assert;
final class MonospaceResponse extends Response
name: Code check
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
types: [ synchronize, opened, reopened, ready_for_review ]
jobs:
@faizanakram99
faizanakram99 / 01_httpd_phpfpm.config
Created April 27, 2020 20:23 — forked from mattzuba/01_httpd_phpfpm.config
Apache 2.4 / PHP-FPM 5.5 on Amazon Elastic Beanstalk
packages:
yum:
php55-fpm: []
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/26_phpfpm_config.sh":
mode: "000755"
owner: root
group: root
content: |
@faizanakram99
faizanakram99 / ArgumentResolverTest.php
Last active October 13, 2021 13:07
RequestDTOArgumentValueResolver
<?php
namespace Qbil\Tests\CommonBundle\Services;
use Qbil\CommonBundle\Services\DTOArgumentValueResolver;
use Qbil\Tests\Fixtures\Controller\DTOController;
use Qbil\Tests\Fixtures\DTO\Person;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
<?php
namespace Qbil\CommonBundle\Services;
use Qbil\CommonBundle\Exception\LoadingConfigurationFailedException;
interface ConfigurationAdapterInterface
{
/**
* @throws LoadingConfigurationFailedException
<?php
use Aws\Ec2\Ec2Client;
use Aws\ElasticBeanstalk\ElasticBeanstalkClient;
use Aws\ElasticBeanstalk\Exception\ElasticBeanstalkException;
use Aws\Rds\Exception\RdsException;
use Aws\Rds\RdsClient;
require __DIR__.'/vendor/autoload.php';
<?php
// .....
class blaBla
{
/**
* @Route("/suggestdestinations")
*
* @return \Symfony\Component\HttpFoundation\Response