This is part of the series tinker like a boss (in psysh)

  1. tinker… what?
  2. includes
  3. casters (presenters)
  4. aliases
  5. http (and other) helpers
  6. wtf is this error?

Custom includes

Let’s stick to a convention of a .tinker file bootstrapping our REPL env. PsySH allows including such file in 2 ways:

  1. inline, provided at runtime:

    In this case we could simply register an alias:
  2. However, there’s a better way: PsySH global config via ~/.config/psysh/config.php file (read more in the docs) and this is what we’re going to do:

The file that we will use for the project may look like this:

You can add here any code you like, that will be available ONLY in the REPL, but not during normal application runtime. That said, you’re free to create anything that will make your workflow easier.

ps. continue to the next post about caster for _Tinker helper class

 

Enjoy and share your thoughts in the comments below or on twitter @SOFTonSOFA

Now is the time to go to your console, type $ php artisan tinker and follow along

Laravel – tinker like a boss with PsySH from Jarek on Vimeo.

It's only fair to share...Tweet about this on TwitterShare on RedditPin on PinterestShare on FacebookShare on Google+

Related Post

Tinker like a boss – aliases This is part of the series tinker like a boss (in psysh) tinker... what? includes casters (presenters) aliases http (and other) helpers ...
Tinker like a boss – custom casters This is part of the series tinker like a boss (in psysh) tinker... what? includes casters (presenters) aliases http (and other) helpers ...
Tinker like a boss (in psysh) tinker... what? includes casters (presenters) aliases http (and other) helpers wtf is this error? Tinker... what? REPL idea...
Querying relations in Laravel: get Models where la... Another part of Querying relations in Laravel will cover such problem: I want to get SomeModels that have latest RelatedModel (hasMany) matchin...