Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

00f100/fcphp-controller

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

00f100/fcphp-controller

Abstract class Controller to FcPhp

Source
Packagist
Version
dev-master
Version published
Maintainers
1
Created
Source

FcPhp Controller

Abstract class to Controller FcPhp

Build Status codecov

PHP Version Packagist Version Total Downloads

How to install

Composer:

$ composer require 00f100/fcphp-controller

or add in composer.json

{
    "require": {
        "00f100/fcphp-controller": "*"
    }
}

How to use

Extends your controller from FcPhp Controller and add your services into Controller using contruct method. After call to service using "getService()" method.


namespace Example
{
    use FcPhp\Controller\Controller;

    class ExampleController extends Controller
    {
        public function __construct($userService, $profileService, $addressService)
        {
            $this->setService('user', $userService);
            $this->setService('profile', $profileService);
            $this->setService('address', $addressService);
        }

        public function findUsers()
        {
            return $this->getService('user')->findAll();
        }

        public function findProfiles()
        {
            return $this->getService('profile')->findAll();
        }

        public function findAddresses()
        {
            return $this->getService('address')->findAll();
        }
    }
}

Controller Callback


use Example\ExampleController;

$instance = new ExampleController(UserService(), ProfileService(), AddressService());

// Callback on find service using "getService()"...
$instance->callback('callbackService', function(string $service, $instance) {

    // Your code here...

});

FAQs

Package last updated on 17 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts