Download the PHP package icekson/remote-services without Composer

On this page you can find all versions of the php package icekson/remote-services. 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 remote-services

Description

Api services is developed in such way that it is fraework independed and can work with any PHP framework;

For dispatching is used route /api/v:version/:serviceName/:actionName, where

* version : version of api (for example v1)
* serviceName - service's name
* serviceAction - action's name

Each service should implement \Api\Service\RemoteServiceInterface. For determining what the service and action should be dispatched I use annotations (Doctrine\Common\Annotations is used as engine for parsing annotations).

Example:

For the convenience there is implemented abstract class Api\Service\BaseService which already implements interface RemoteServiceInterface and can be used as base class for services;

BTW, if you want to hide your service from public (add authorization by token, permissions checks etc.) you have to implement two additional interfaces Api\Service\SecurityServiceInterface and Api\Service\SecurityOwnerPermissionInterface

here is the full version of service example:

As you can see from the code, name of service is defined by according annotation @Service(name = "advertiser") and name of action - @ServiceAction(name="GetOffers") that's matches to url: /api/v1/advertiser/GetOffers

Dispatching of requests

Workflow is the following:

1 Both name of service and name of action are retrieved from routing 2 The new instance of \Api\Dispatcher is created 3 All the paths which contains implementations of services are need to be registered in dispatcher 4 According service is called

Example:

Permissions setup

If your service implements Api\Service\SecurityServiceInterface then you should send access_token parameter with each request, you can keep all the tokens in DB or somewhere else. Validation of token you have to implement in method SecurityServiceInterface::isPermitted($token)

Role based permissions

The list of roles and related permissions are placed in file api/config/permissions.php. Here we should describe the roles. If role is not defined explicity the access will be denied. The access can be defined for appropriate service/action (serviceName.serviceAction) as well as for all actions in the service (serviceName.*):

Also you can use inheritance of roles by using key 'extends' for any role and to list there parent roles, in such case this role will be extend all permissions from prent roles;

Example of api/config/permissions.php

Setup of columns, filters, grouings

For any action we can use available columns, filters and groupings. Here is we use annotations as well

@AcceptableColumns() @AcceptableFilters() @AceptableGroupings()

Few examples:

As we can see, we can put the same annotations few times (@AcceptableColumns) in this case the most appropriate role of user will be choosen, by default will be selected the annotation whithout any role. As well you can use 'extendDefault = true' and all the columns will be extended from default annotation

AcceptableColumns

The columns can be defined as a string or array

api/v1/someService/someAction?columns=all api/v1/someService/someAction?columns=name,id,date api/v1/someService/someAction?columns[]=name&columns[]=id&columns[]=date

If parameter columns will be empty then 'columns=all' will be used. If you give incorrect columns, you will get error with the list of available columns;

AcceptableFilters

api/v1/someService/someAction?filters[date_from]=2011-01-01&filters[date_to]=2014-01-01

AcceptableGroupings

Format is the same as in columns

api/v1/someService/someAction?group=name,id,date api/v1/someService/someAction?group[]=name&group[]=id&group[]=date


All versions of remote-services with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
zendframework/zend-cache Version ~2.5
psr/log Version 1.0.*
monolog/monolog Version ~1.12
doctrine/annotations Version ~1.4
zfr/rbac Version ~1.2
psr/container Version ^1.0
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 icekson/remote-services contains the following files

Loading the files please wait ....