wayhood / hyperf-service
Installs: 166
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/wayhood/hyperf-service
Requires
- php: >=8.0
README
A Service Annotation for Hyperf
Example
auto set dependencies
TestSerivce -> TestServiceImpl
<?php
namespace App\Service;
interface TestService
{
public function getTest(): string;
}
<?php
namespace App\Service\Impl;
use App\Service\TestService;
use Wayhood\Service\Annotation\Service;
#[Service]
class TestServiceImpl implements TestService
{
public function getTest(): string {
return "abc";
}
}
namespace App\Controller;
use App\Service\TestService;
use Hyperf\Di\Annotation\Inject;
class IndexController extends AbstractController
{
#[Inject]
protected TestService $testService;
public function index()
{
return $this->testService->getTest();
}
}