Front Service (Bll) Skill
Mission
Create Business Logic Layer services that call API services.
Location
- •Front:
front/src/Service/Bll/<Name>Service.php - •Back:
back/src/Service/Bll/<Name>Service.php
Template
php
<?php
namespace App\Service\Bll;
use App\Service\Api\Api<Feature>;
use StarterKit\Model\ApiResult;
use StarterKit\Service\Bll\HelperService;
class <Feature>Service
{
public function __construct(
private readonly HelperService $helper,
private readonly Api<Feature> $api,
) {
$this->helper->logDebug("[App] - Service - <Feature>Service - Load");
}
public function read(string $key): ApiResult
{
$this->helper->logDebug("[App] - Service - <Feature>Service - Read");
return $this->api->read($this->helper->getLanguage(), $key);
}
public function update(string $key, array $data): ApiResult
{
$this->helper->logDebug("[App] - Service - <Feature>Service - Update");
return $this->api->update($this->helper->getLanguage(), $key, $data);
}
}
Key Rules
- •Constructor injection (unlike Route controllers)
- •Inject
HelperServicefor language and logging - •Use
$this->helper->getLanguage()for API calls - •Return
ApiResult - •Log method calls
Checklist
- •
HelperServiceinjected - • Api service(s) injected
- • Methods use
$this->helper->getLanguage() - • Debug logging at method entry
- • Returns
ApiResult