Download the PHP package rips/connector-bundle without Composer

On this page you can find all versions of the php package rips/connector-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package connector-bundle

RIPS Connector Bundle

A Symfony bundle wrapper around the RIPS Connector package. This library provides easy access to RIPS and all of its features.

Installation

Use composer to include the package:

composer require rips/connector-bundle:~3.4

OR add the following to composer.json and run composer update.

"rips/connector-bundle": "~3.4"

This library is intended for Symfony applications but it can also be used on its own. If used with Symfony, the installation of the connector bundle should automatically create an entry in the bundles.php file that looks like this:

return [
    // ...
    RIPS\ConnectorBundle\RIPSConnectorBundle::class => ['all' => true], 
    // ...
];

Additionally, you have to add config settings in app/config/rips_connector.yaml (see rips/connector readme for a list of config options). If you are not using Symfony you can specify the options through the constructor of APIService.

rips_connector:
    base_uri: 'http://localhost:8080'
    email: 'email'
    password: 'password'

Usage

A basic example for a console application that gets a list of all users without Symfony looks like this:

<?php

include 'vendor/autoload.php';

use RIPS\ConnectorBundle\Services\APIService;
use RIPS\ConnectorBundle\Services\UserService;

// Create an API service object that gets passed to all other services
$apiService = new APIService(
    'username',
    'password',
    [
        "base_uri" => 'http://localhost:8080'
    ]
);

$userService = new UserService($apiService);

// Get all users
$users = $userService->getAll()->getUsers();

foreach ($users as $user) {
    echo $user->getEmail() . "\n";
}

The bundle can be easily integrated in Symfony applications like this:

<?php

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use RIPS\ConnectorBundle\Services\UserService;
use RIPS\ConnectorBundle\InputBuilders\UserBuilder;
use RIPS\Connector\Exceptions\ClientException;
use RIPS\Connector\Exceptions\ServerExecption;

class DefaultController extends Controller
{
    /** @var UserService */
    protected $userService;

    public function __construct(UserService $userService)
    {
        $this->userService = $userService;
    }

    public function indexAction()
    {
        try {
            // Get all users
            $users = $this->userService->getAll()->getUsers();

            // Add a new user
            $response = $this->userService->create(
                new UserBuilder([
                    'email'         => '[email protected]',
                    'plainPassword' => '***********'
                ])
            )->getResponse();
        } catch (ClientException $e) {
            // 4** error
        } catch (ServerException $e) {
            // 5** error
        }

        return $this->render('default/index.html.twig', ['users' => $users]);
    }
}

Architecture

This section contains an overview of the architecture used for this bundle.

Services

Services are the main wrapper around the RIPS-Connector library. The RIPS\Connector\API class is initialized in APIService, and all other services expect APIService to be injected (see services.yml).

Each service class should have a corresponding Requests class in RIPS-Connector. An accessor method is added to the APIService class for every Requests class for easier access.

The directory structure attempts to follow the directory structure of the API controllers.

Entities

Instead of returning stdClass objects or an array, data returned from the API is mapped to custom Entity classes that are returned by response classes. The responses are returned by the service classes.

The entities are just custom classes with getters/setters for all properties. In some cases they will have nested entities. For example: the UserEntity will have a nested OrgEntity as a user belongs to an organization. It is highly advised to check if sub objects exist before accessing them.

Hydrators

Hydrators in the connector-bundle are used to populate the custom Entity classes with data returned from the RIPS Connector library. They expect stdClass objects (returned from RIPS Connector) which are mapped into the entity classes.

In some situations you will have nested objects (a UserEntity contains a nested OrgEntity) in which case it's best to reuse the OrgHydrator in the UserHydrator to populate the nested OrgEntity object.

InputBuilders

It would be difficult to remember all the expected input parameters a request might have. To aid in this, InputBuilder classes are created that have all the expected parameters as properties with getters/setters. It is also possible to pass an array of data to the constructor which will populate the corresponding fields.


All versions of connector-bundle with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
rips/connector Version ^3.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rips/connector-bundle contains the following files

Loading the files please wait ....