Download the PHP package iml885203/laravel5-tinx without Composer
On this page you can find all versions of the php package iml885203/laravel5-tinx. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iml885203/laravel5-tinx
More information about iml885203/laravel5-tinx
Files in iml885203/laravel5-tinx
Package laravel5-tinx
Short Description Reload your Laravel Tinker session from inside Tinker, plus magic shortcuts for first(), find(), where(), and more!
License MIT
Informations about the package laravel5-tinx
Laravel5 Tinx
This project is for Laravel 5.1. forked from Laravel Tinx.
Laravel Tinker, re()loaded.
Reload your session from inside Tinker, plus magic shortcuts for first(), find(), where(), and more!
Installation
To install Tinx, simply require it via Composer:
If using Laravel <=5.4, register Tinx's service provider in config/app.php
(Laravel >=5.5 does this automatically):
Usage
From the command line, instead of running php artisan tinker
, run:
Reload your Tinker session
To reboot your current session, simply call:
This will allow you to immediately test out your application's code changes.
Aliases: reboot()
, reload()
, restart()
.
To regenerate Composer's optimized autoload files before rebooting your current session, call:
Calling reo()
simply runs composer dump -o
before re()
, ensuring any new classes added to your codebase since starting Tinx are automatically aliasable/resolvable by Laravel Tinker.
Magic models
Tinx sniffs your models and prepares the following shortcuts:
Example Shortcut | Equals |
---|---|
$u |
App\User::first() |
$u_ |
App\User::latest()->first() |
$c |
App\Models\Car::first() |
u(3) |
App\User::find(3) |
u("gmail") |
Where "%gmail%" is found in any column. |
u() |
app("App\User") |
u()->whereRaw(...) |
app("App\User")->whereRaw(...) |
Naming strategy
Tinx calculates shortcut names via the implementation defined by your strategy
config value.
Lets say you have two models: Car
and Crocodile
.
If your naming strategy
was set to pascal (default), Tinx would define the following shortcuts in your session:
- Car:
$c
,$c_
,c()
- Crocodile:
$cr
,$cr_
,cr()
Names
The shortcuts defined for your session will display when Tinx loads and on subsequent reloads.
To see your shortcuts at any time during your session, run:
Your shortcuts will initially display only if your session satisfies the names_table_limit
config value.
To filter the shortcuts returned by names()
, simply pass your filter terms like so:
Configuration
Tinx contains a number of helpful configuration options.
To personalise your Tinx installation, publish its config file by running:
Once published, edit config/tinx.php
where appropriate to suit your needs:
Contributing
Please post issues and send PRs.
License
MIT