1. Go to this page and download the library: Download chkt/lola 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/ */
chkt / lola example snippets
//App.php
namespace app\app;
final class App
extends \lola\app\App
{
}
//MyController.php
namespace myModule\controller;
use lola\ctrl\AController;
use lola\inject\Injector;
use lola\route\Route;
class MyController
extends AController
{
static public function getDependencyConfig(array $config) {
return [[
'type' => Injector::TYPE_INJECTOR
],[
'type' => Injector::TYPE_SERVICE,
'id' => '//myOtherModule/my'
]];
}
private $myService = null;
public function __construct(
Injector& $injector,
MyService& $myService
) {
$this->myService = $myService;
$this->setRequestTransform($injector->produce('\\myModule\\controller\\MyControllerRequestTransform'));
$this->setReplyTransform($injector->produce('\\myModule\\controller\\MyControllerReplyTransform'));
}
public function myAction(Route& $route) {
$this->myService->doSomething($route->getParam('param'));
}
}
//MyRequestTransform.php
namespace app\ctrl;
use lola\ctrl\ControllerProcessor;
use lola\inject\IInjectable;
class MyRequestTransform
extends ControllerProcessor
implements IInjectable
{
static public function getDependencyConfig(array $config) {
return [];
}
public function fooStep(MyEntity& myEntity) {
//...
}
public function barStep(MyEntity& myEntity) {
//...
}
}
//MyService.php
namespace app\service;
use lola\service\AService;
final class MyService
extends AService
{
static public function getDependencyConfig(array $config) {
return [];
}
public function doSomething() {
//...
}
}
sh
$ php composer.phar install chkt/lola
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.