PHP code example of uttamrabadiya / console-components

1. Go to this page and download the library: Download uttamrabadiya/console-components 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/ */

    

uttamrabadiya / console-components example snippets


use ConsoleComponents\Writer;

Writer::info('Hello World! PHP is beautiful');

use ConsoleComponents\Writer;

Writer::warn('Please check message');

use ConsoleComponents\Writer;

Writer::error('Something went wrong!');

use ConsoleComponents\Writer;

Writer::alert('Hello World!');

use ConsoleComponents\Writer;

Writer::ask('What would you like to build today?');
Writer::ask('Something secret to ask', hidden: true); // Ask secretly

use ConsoleComponents\Writer;

Writer::askWithCompletion('How are you today?', ['Good', 'Better', 'Ok Ok']);

use ConsoleComponents\Writer;

Writer::bulletList(['Item 1', 'Item 2', 'Item 3']);

use ConsoleComponents\Writer;

Writer::choice('What are you working on today?', ['Open source application', 'Building Profile', 'Inventing new feature']);

use ConsoleComponents\Writer;

Writer::confirm('Are you sure you want to continue?');

use ConsoleComponents\Writer;

Writer::twoColumnDetail('PHP', 'Installing');
Writer::task('PHP');

use ConsoleComponents\Writer;

Writer::table(['Applications', 'Version'], [['PHP', '8.2'], ['NGINX', 1.2], ['MySQL', 8.0]]);