This package allows die and dump in one input. If there is no input, it will die and dump a default greeting message which is "Hello world". You can change the default message by setting HELLO_WORLD_MESSAGE in .env file also you can log messages to log and clear log file.
use AhmedHelalAhmed\LaravelGreeting\Greeting;
// It will dump hello world as no input given and default message not changed
Greeting::sayMessage();
use AhmedHelalAhmed\LaravelGreeting\Greeting;
// It will dump hello world and stop execution as continue set with false
Greeting::sayMessage('hello world',false);
use AhmedHelalAhmed\LaravelGreeting\Greeting;
$x = 10;
Greeting::sayMessage([
'message1' => 'test',
'x' => $x,
'request' => request()
]);
// it will show input array like that
/*
array:3 [▼
"message1" => "test"
"x" => 10
"request" => Illuminate\Http\Request {
}
]
*/
// stop sending messages
Greeting::stop();
// this has no effect at all
Greeting::sayMessage();
// this has no effect as Greeting messages stopped
Greeting::sayMessage("Welcome",false);
// continue sending messages
Greeting::start();
// this will dump the message and die
Greeting::sayMessage("Hello world",false);
use AhmedHelalAhmed\LaravelGreeting\Greeting;
// this will dump welcome message and log it to storage file
Greeting::sayAndLog('welcome');
// this will log welcome to storage file and dump welcome message then stop execution
Greeting::sayAndLog('welcome',false);
use AhmedHelalAhmed\LaravelGreeting\Greeting;
// this will clear the content of log file
Greeting::resetLog();
// you can install
// https://github.com/rap2hpoutre/laravel-log-viewer
// to view logs
You can install the package via composer:
composer require --dev ahmedhelalahmed/laravel-greeting
Then publish the configurations:
php artisan vendor:publish --provider="AhmedHelalAhmed\LaravelGreeting\LaravelGreetingServiceProvider"
Thank you for considering contributing to ahmedhelalahmed/laravel-greeting .
If you discover a security vulnerability within ahmedhelalahmed/laravel-greeting , please send an e-mail to Ahmed Helal via [email protected]. All security vulnerabilities will be promptly addressed.
ahmedhelalahmed/laravel-greeting is open-sourced software licensed under the MIT license.