Download the PHP package ssa/core without Composer

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

SSA : Simple Service Access

SSA is a framework to simply perform Ajax call. You can call your service as PHP into you javascript.

Usage

Example

The usage of ssa is very simple, you create your PHP service, and you can call this service in javascript code. For example : HelloWorld.php

example.html

This exemple add "Hello deblock !!" into the serviceResult div.

Working

For convert the service into Javascript service ssa use doc comment. It's use the @param annotation for know parameters and type parameters. If a php parameter have no comment, they will not be export into javascrit service.

For run the service, @param annotations are used, the type is use for convert $_POST parameters into PHP type. Type support can be primitive, complete class name (with namespace), \DateTime(inputFormat, file or array. \DateTime and array are specific. \DateTime type have parameter input format. Example \DateTime(m/d/Y) array can have parameter. Example array(int) array(int) array(\Path\To\My\Class) array(file) ...

Javascript service have multiple method for handle ajax event.

ssa.js has two default handler :

serviceTest.js

each callback have the same object context, you can pass variable between this callbacks.

Support

Ssa support multiple type parameter, and return value. Parameters and return value can be, primitive type, object or DateTime, array, you can simply add an other type support.

Ssa support file uploaded, if you want upload a file you must use the file, or array(file) types.

service.php

FileUpload.js

Warning the file uploaded is not support by all navigator, it use FormData class. The method ssa.supportFileUpload return true if the navigator support this function. When you run a service with file upload the callback formDataError is call is this function is not supported.

Ssa support multiple javascript framework :

If you want see ssa exemple you can look on test/ssa/toEndTest directory

Configuration

The ssa configuration is different between standalone version, and the symfony version.

Symfony version

For symfony version you can look this bundle project

Standalone

The documentation of the Standalone version is under.

Register you service

The simple way for register your service is to create a configuration.php files. this file call the serviceManager for register your own services.

configuration.php

Configure SSA

SSA can be configured, the configuration can be in the configuration.php file.

configuration.php

Add type support

If default type support of ssa is not suffisant, you can define your own type support. You have two way to do this, add simple a type support (for object, or for parameter), or create a new ParameterResolver who resolve primitive and object. A default ParameterResolver exists, it can resolve primitiveType, array, object, and \DataTime.

The first method to add a type resolver is add directly into the default type resolver. configuration.php

Your own ObjectResolver and your ParameterResolver need impements ssa\runner\resolver\ObjectResolver, ssa\runner\resolver\PrimitiveResolver. see documentation of PrimitiveResolver and ObjectResolver.

Or you can create your own ParameterResolver (not recommended). your ParameterResolver need implement ssa\runner\resolver\ParameterResolver.

run.php

Create an encoder

The encoder is use for encode your function return into javascipt value. The default encoder is the JsonEncoder, this encoder can convert primitive type, array, and object. Objects are convert with getter methods, each getter is convert into a JSON property. If you need you can create your own encoder, you can do this, it's simple. On your service action you need to add @Encoder annotation. Service.php

The action method use MyEncoder for convert the return on JSON or other format. Your encoder must implements ssa\runner\converter\Encoder, or extends ssa\runner\converter\DefaultJsonEncoder.

Installation

Il you want use SSA you have many solution.

Use with symfony

An other project allow to simply add this project into your symfony project. see ssa/symfony.

Use the standalone version

The standalone version is enable.

Download with Composer

The first solution is to use a project with composer, you can just add ssa/core dependencies.

Download without composer

If you don't want use composer, you can add ssa into you project.

Controller creation

For use the standalone version of SSA you need to use two php file, one to create javascript service, one to run the php controller. this two php files, need to use configuration php file for register your services.

configuration.php

run.php

javascript.php

for example for get javascript HelloWorld service the url is http://localhost/javascript.php?service=HelloWorld

finaly you need include ssa.js into you javascript folder.

More usages

Add Own Javascript on generated service

You can add your own javascript on the generated services. If you wand inject your own code, you need use ssa\converter\annotations\AddJavascript annotation. It have own parameter : the js file to add, the path is a relative path.

AuthenticateService.php

If you want add methods on generated service, you can create function named "module", this function have one parameter : the generated service. this function is call when the service is generating.

Add serviceRunner handler

You can add handler for serviceRunner, the handler called before and after the service runned. The handler is an Annotation, if the annotation is on the function comment, handlers are called.

You need to create an annotation like this :

Secure.php

And you can call your handler like this :

service.php


All versions of core with dependencies

PHP Build Version
Package Version
Requires doctrine/annotations Version *
doctrine/cache Version *
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 ssa/core contains the following files

Loading the files please wait ....