Skip to content

Instantly share code, notes, and snippets.

@AndriiMz
Created September 26, 2025 08:35
Show Gist options
  • Select an option

  • Save AndriiMz/7cab36164dc5a234def4c70e314c0877 to your computer and use it in GitHub Desktop.

Select an option

Save AndriiMz/7cab36164dc5a234def4c70e314c0877 to your computer and use it in GitHub Desktop.
symfony.php
<?php
/** snippet 1 */
class EmailWebhookController
{
public function handle(Request $request, HandleEmail $handleEmail)
{
$handleEmail->__invoke($request->get('message'), $request->get('accountId'));
return new Response('OK');
}
}
/** snippet 2 */
class UserNotifier
{
private $mailer;
public function __construct()
{
$this->mailer = new \App\Service\Mailer();
}
public function notify(string $email, string $message)
{
$this->mailer->send($email, 'Notification', $message);
}
}
/** snippet 3 */
public function findExpensiveProducts($price)
{
return $this->getEntityManager()
->createQuery("SELECT p FROM App\Entity\Product p WHERE p.price > $price")
->getResult();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment