1. Go to this page and download the library: Download ricardoper/micra 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/ */
use App\Kernel\Abstracts\CommandAbstract;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class HelloCommand extends CommandAbstract
{
/**
* Command name
*
* @var string
*/
protected $cmdName = 'Hello';
/**
* Configure/explain command
*/
protected function configure()
{
$this
->setName($this->cmdName)
->setDescription('Hello World!');
}
/**
* Execute command process
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln('Hello World!');
return 0;
}
}
use App\Commands\Demo\HelloCommand;
return [
'hello' => HelloCommand::class,
];
use App\Kernel\Abstracts\ModelAbstract;
use PDO;
class AddressesModel extends ModelAbstract
{
/**
* Get Last Addresses with Pdo
*
* @param int $limit
* @return array
*/
public function getLastWithPdo(int $limit = 25): array
{
/** @var $db PDO */
$db = $this->getDb()->pdo;
$sql = 'SELECT `address`.`address_id`,`address`.`address`,`address`.`address2`,`address`.`district`,`city`.`city`,`address`.`postal_code`,`address`.`phone` FROM `address` ';
$sql .= 'LEFT JOIN `city` ON `address`.`city_id` = `city`.`city_id` ';
$sql .= 'ORDER BY `address_id` DESC LIMIT 10';
return $db->query($sql)->fetchAll(PDO::FETCH_ASSOC);
}
use App\Kernel\Interfaces\ServiceProviderInterface;
use Pimple\Container;
class ExampleServiceProvider implements ServiceProviderInterface
{
/**
* Service register name
*/
public function name(): string
{
return 'example';
}
/**
* Register new service on dependency container
*
* @param Container $container
* @return mixed
*/
public function register(Container $container)
{
return function (Container $c) {
unset($c);
return new Example();
};
}
}
use App\Services\Example\ExampleServiceProvider;
return [
'example' => ExampleServiceProvider::class,
];
use App\Handlers\ErrorHandler;
use App\Handlers\ShutdownHandler;
return [
// Handlers //
'errorHandler' => ErrorHandler::class,
'shutdownHandler' => ShutdownHandler::class,
use App\Services\Database\DatabaseServiceProvider;
return [
'database' => DatabaseServiceProvider::class,
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.