Skip to content

Instantly share code, notes, and snippets.

@thepsion5
thepsion5 / RendersTemplates.php
Created February 1, 2022 17:50
Example of Using Composition via Traits to Remove Duplicate Controller Logic
<?php
declare(strict_types=1);
namespace Personly\Http\Traits;
use Personly\Framework\Rendering\TemplateRenderer;
use Symfony\Component\HttpFoundation\{JsonResponse, Response};
trait RendersTemplates
@thepsion5
thepsion5 / SlowQueryLogDecorator.php
Created December 21, 2022 20:06
Using Aura\SQL to Log Slow Queries via a simple Decorator Class
<?php
declare(strict_types=1);
namespace YourApp\Infrastructure\Logging;
use Psr\Log\{LoggerInterface, LoggerTrait};
class SlowQueryLogDecorator implements LoggerInterface
{
use LoggerTrait;