Package Data | |
---|---|
Maintainer Username: | spatie |
Maintainer Contact: | freek@spatie.be (Freek Van der Herten) |
Package Create Date: | 2017-05-12 |
Package Last Update: | 2024-09-30 |
Home Page: | https://freek.dev/748-quickly-dd-anything-from-the-commandline |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-02 03:03:26 |
Package Statistics | |
---|---|
Total Downloads: | 82,449 |
Monthly Downloads: | 285 |
Daily Downloads: | 8 |
Total Stars: | 158 |
Total Watchers: | 6 |
Total Forks: | 15 |
Total Open Issues: | 0 |
Laravel's tinker command allows to run any code you want as if you are inside your Laravel app. But if you want to run a single line of code if can be a bit bothersome. You must start up tinker, type the code, press enter, and quit tinker.
This package contains an Artisan command to dd anything from the commandline. No need to start and quit tinker anymore.
# dumps the first user
php artisan dd "User::first()"
You can install the package via composer:
composer require spatie/laravel-artisan-dd
You must register the Spatie\ArtisanDd\DdCommand
in the console kernel.
// app/Console/Kernel.php
protected $commands = [
...
\Spatie\ArtisanDd\DdCommand::class,
];
You can pass any code you want to execute as the first argument. The result will be dumped to the screen.
php artisan dd "bcrypt('secret')";
Multiple pieces of code can be dumped in one go:
php artisan dd "bcrypt('secret')" "bcrypt('another-secret')";
Under the hood registers short class names using our laravel-tinker-tools package. So instead of
php artisan dd "\App\Models\NewsItem::first()";
you can do this:
php artisan dd "NewsItem::first()";
This command can run arbitrary code by using PHP's eval
. Be aware that this can be potentially dangerous. By default the command will only run in a local
environment. You can make it run in other environments by setting an ALLOW_DD_COMMAND
enviroment variable to true
.
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker.
You're free to use this package (it's MIT-licensed), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.
We publish all received postcards on our company website.
Idea: Sebastian De Deyne
Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
Does your business depend on our contributions? Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.
The MIT License (MIT). Please see License File for more information.