Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Laravel News:
Getting to Know the Laravel Tinker Shell
Sep 12, 2017 @ 16:30:39

On the Laravel News site today there's a post introducing you to Tinker the command-line REPL (read-eval-print-loop) tool that integrates with the Laravel artisan command-line tool.

Laravel includes a powerful REPL, called Tinker, powered by the PsySH console by Justin Hileman under the hood. The tinker console allows you to interact with your Laravel application from the command line in an interactive shell.

Tinker used to be part of the laravel/framework package, but with the release of Laravel 5.4 is extracted into separate package.

They start the post by talking about what a REPL is and how it can be used to test things on the command line without needing to write up a full test script. They then show how to install the tool Tinker is based on globally (Psych) including a brief overview of how to use it. Next comes the Tinker-specific functionality including examples of the documentation commands, testing helpers and job execution features.

tagged: tinker artisan shell repl psych tutorial introduction

Link: https://laravel-news.com/laravel-tinker

Tighten.co:
Supercharge Your Laravel Tinker Workflow
May 11, 2017 @ 14:37:19

On the Tighten.co blog they have a new post that aims to help you get the most out of the Laravel command line tool's (artisan) tinker command.

Laravel's command line tool is called "Artisan," and it comes with a few powerful features out of the box. Tinker, accessed via php artisan tinker, is arguably my favorite Artisan command. It speeds up my workflow and allows me to interact with my application in ways I would have never thought possible.

Tinker is a REPL (read-eval-print loop). A REPL gives you a prompt that allows you to interact with your application using your language's native syntax (in this case, PHP) in a command-line style.

The post then walks through some of the "hidden features" this command line tool offers including:

  • basic usage to call Laravel code (like getting all posts using Post::all)
  • a more interactive version of dd(), a debugging tool
  • improving speed on a Laravel Dusk testing workflow
  • direct access to the PHP docs

The post ends with a few other smaller things this helpful tool can do like showing a stack trace, listing the command history and re-throwing the last exception.

tagged: laravel workflow tinker commandline tool artisan tutorial

Link: https://blog.tighten.co/supercharge-your-laravel-tinker-workflow


Trending Topics: