PHP code example of fei / connect-package

1. Go to this page and download the library: Download fei/connect-package 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/ */

    

fei / connect-package example snippets




namespace Fei\Service\Project;

use ObjectivePHP\Application\AbstractHttpApplication;
use Fei\Service\Connect\Package\ConnectPackage;

/**
 * Class Application
 *
 * @package Showcase
 */
class Application extends AbstractHttpApplication
{
    public function init()
    {        
        $this->registerPackage(new ConnectPackage());
        
        // Register other stuff
    }
}



namespace Fei\Service\Project\Services;

use Fei\Service\Connect\Package\UserAwareInterface;
use Fei\Service\Connect\Package\UserAwareTrait;

/**
 * Class Application
 *
 * @package Showcase
 */
class MyService implements UserAwareInterface
{
    use UserAwareTrait;
    
    public function myBusinessMethod()
    {
        // Doing my business  
        
        $this->getUser(); // Returns Connect-User service instance
        
        // Doing other business stuff
    }
}