Skip to content

Instantly share code, notes, and snippets.

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