1. Go to this page and download the library: Download softadastra/ivi 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/ */
softadastra / ivi example snippets
declare(strict_types=1);
use App\Console\Commands\AboutCommand;
use App\Providers\AppServiceProvider;
use Ivi\Config\Config;
use Ivi\Framework\Framework;
$basePath = dirname(__DIR__);
fig->get(
'app.environment',
'production'
),
consoleName: (string) $config->get(
'app.name',
'Ivi Application'
),
consoleVersion: (string) $config->get(
'app.version',
'0.1.0'
)
);
$framework->provider(
AppServiceProvider::class
);
$framework->registerCommand(
new AboutCommand()
);
return $framework;
protected function registerServices(): void
{
// Register container services.
}
protected function bootServices(): void
{
// Complete application initialization.
}
declare(strict_types=1);
namespace App\Console\Commands;
use Ivi\Console\Contracts\CommandInterface;
use Ivi\Console\Contracts\InputInterface;
use Ivi\Console\Contracts\OutputInterface;
final class HelloCommand implements CommandInterface
{
public function name(): string
{
return 'hello';
}
public function description(): string
{
return 'Display a greeting.';
}
public function aliases(): array
{
return [];
}
public function usage(): string
{
return 'hello [name]';
}
public function isHidden(): bool
{
return false;
}
public function execute(
InputInterface $input,
OutputInterface $output
): int {
$name = $input->argument(
0,
'Developer'
);
$output->success(
"Hello, {$name}."
);
return 0;
}
}
use App\Console\Commands\HelloCommand;
$framework->registerCommand(
new HelloCommand()
);
use Ivi\Console\Contracts\InputInterface;
use Ivi\Console\Contracts\OutputInterface;
$framework->command(
name: 'app:environment',
handler: static function (
InputInterface $input,
OutputInterface $output
) use ($framework): int {
$output->info(
'Environment: '
. $framework->environment()
);
return 0;
},
description: 'Display the application environment.',
aliases: [
'env',
]
);