PHP code example of ribafs / hello-world-package-laravel

1. Go to this page and download the library: Download ribafs/hello-world-package-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ribafs / hello-world-package-laravel example snippets



namespace App\Console\Commands;

use Illuminate\Console\Command;

class helloWorld extends Command
{
    protected $signature = 'hello:world';

    protected $description = 'Pequeno comando para demonstração sobre a criação de comandos no laravel 9';

    public function handle()
    {
        return $this->info(PHP_EOL.'Olá Mundo dos pacotes no Laravel 9 '.PHP_EOL);
    }
}

    public function boot()
    {
            ...

            // Publishing the command.
            $this->publishes([
                __DIR__.'/Commands' => app_path('Console/Commands'),
            ], 'commands');
...

composer.json
src/ViewMaker.php
src/ViewMakerFacade.php
src/ViewMakerServiceProvider.php
README.md
E outros

app/Console/Commands
 
nano helloWorld.php

php artisan hello:world

src/HelloWorldServiceProvider.php
bash
php artisan vendor:publish --provider="Ribafs\HelloWorld\HelloWorldServiceProvider"

app/Console/Commands/HelloWorld.php

php artisan hello:world