Skip to content

Instantly share code, notes, and snippets.

@ejunker
ejunker / ContainerCommandLoader.php
Created November 11, 2019 21:26
Lazy-loaded artisan console commands
<?php
namespace App\Console;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
use Symfony\Component\Console\Exception\CommandNotFoundException;
class ContainerCommandLoader implements CommandLoaderInterface
{
<?php
return [
'defaultIncludes' => [
__DIR__ . '/bootstrap-tinker.php',
],
'startupMessage' => sprintf('<info>%s</info>', shell_exec('php artisan inspire')),
];
@ejunker
ejunker / Person.php
Created November 12, 2018 14:42
Read-only properties with IDE autocomplete
<?php
/**
* @property-read string $name
* @property-read int $age
*/
class Person
{
private $name;
private $age;