1. Go to this page and download the library: Download rougin/blueprint 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/ */
php
// bin/app.php
// ...
// Sets the directory for the defined commands ----
$app->setCommandPath(__DIR__ . '/../src/Commands');
// ------------------------------------------------
// Sets the directory for the templates. Useful -----
// for creating commands with template engines ------
$app->setTemplatePath(__DIR__ . '/../src/Templates');
// --------------------------------------------------
// Sets the name of the console application ---
$app->setName('Rrsg');
// --------------------------------------------
// Sets the version of the console application ---
$app->setVersion('0.1.0');
// -----------------------------------------------
// Sets the namespace for the "commands" path ---
$namespace = 'Rrsg\Simplest\Commands';
$app->setCommandNamespace($namespace);
// ----------------------------------------------
// Runs the console application ---
$app->run();
// --------------------------------
php
// src/Commands/TestCommand.php
namespace Rrsg\Commands;
use Rougin\Blueprint\Command;
class TestCommand extends Command
{
protected $name = 'test';
protected $description = 'Returns a "Test" string';
public function execute()
{
$this->showPass('Test');
}
}
php
// src/Sample.php
namespace Rrsg;
class Sample
{
protected $name;
public function __construct($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
}
php
namespace Rrsg\Commands;
use Rrsg\Sample;
use Rougin\Blueprint\Command;
class TextCommand extends Command
{
protected $name = 'text';
protected $description = 'Shows a sample text';
protected $sample;
public function __construct(Sample $sample)
{
$this->sample = $sample;
}
public function run()
{
$this->showText('Hello, ' . $this->sample->getName() . '!');
return self::RETURN_SUCCESS;
}
}
bash
$ php bin/app.php text
Hello, Blueprint!
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.