1. Go to this page and download the library: Download jolicode/castor 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/ */
jolicode / castor example snippets
namespace greetings;
use Castor\Attribute\AsTask;
use function Castor\io;
#[AsTask()]
function hello(): void
{
io()->writeln('Hello from castor');
}
#[AsTask(description: 'Clean the infrastructure (remove container, volume, networks)')]
function destroy(bool $force = false)
{
if (!$force) {
io()->warning('This will permanently remove all containers, volumes, networks... created for this project.');
io()->comment('You can use the --force option to avoid this confirmation.');
if (!io()->confirm('Are you sure?', false)) {
io()->comment('Aborted.');
return;
}
}
run('docker-compose down -v --remove-orphans --volumes --rmi=local');
notify('The infrastructure has been destroyed.')
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.