1. Go to this page and download the library: Download 00f100/fcphp-service 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/ */
00f100 / fcphp-service example snippets
namespace Example
{
use FcPhp\Service\Service;
class ExampleService extends Service
{
public function __construct($userRepository, $profileRepository, $addressRepository)
{
$this->setRepository('user', $userRepository);
$this->setRepository('profile', $profileRepository);
$this->setRepository('address', $addressRepository);
}
public function findUsers()
{
return $this->getRepository('user')->findAll();
}
public function findProfiles()
{
return $this->getRepository('profile')->findAll();
}
public function findAddresses()
{
return $this->getRepository('address')->findAll();
}
}
}
use Example\ExampleService;
$instance = new ExampleService();
// Callback on find service using "getService()"...
$instance->callback('callbackRepository', function(string $repository, $instance) {
// Your code here...
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.