{"repo":"spatie/laravel-tinker-tools","free":true,"listed":false,"github":"https://github.com/spatie/laravel-tinker-tools","clone":"git clone https://github.com/spatie/laravel-tinker-tools.git","description":"Use short class names in an Artisan tinker session","language":"PHP","stars":138,"topics":["laravel","composer","php","devtools"],"license":"MIT","category":"dev-tools","readme_excerpt":"The functionality of this package is built into Laravel 5.5 and above, only install this in older Laravel versions Use short class names in an Artisan Tinker session When using Artisan's Tinker command it can be quite bothersome having to type the fully qualified classname to do something simple. This package contains a class that, when fully installed lets you use the short class names: Support us We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products. We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall. Installation First install the package via Composer: Next, create a file named .psysh.php in the root of your Laravel app with this content: Finally, dump the optimized version of the autoloader so autoload classmap.php gets created: Usage Open up a Tinker session with: Inside that Tinker session you can now use short class names: A peek behind the curtains When you use a class that hasn't been loaded in yet, PHP will call the registered autoloader functions. Such autoloader functions are responsible for loading up the requested class. In a typical project Composer will register an autoloader function that can include the file where the class is stored in. Composer has a few ways to locate the right files. In most cases it will ","default_branch":null,"files":null,"tree":[],"storefront":"/r/spatie","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/spatie/laravel-tinker-tools/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}