Download the PHP package robgridley/pace-api without Composer

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

Pace API Client

An unofficial PHP client library for EFI Pace's SOAP API, created by a Pace administator and PHP developer. This library makes make some assumptions about convention to make your life just a little bit easier.

Installation

Install via Composer:

Testing

PHPUnit tests with 100% code coverage for Model, KeyCollection and XPath\Builder classes.

To run the tests:

To-dos

Configuration

You'll need to create a Pace system user with "Allow remote API usage" enabled.

CRUDD

Creating an object

To create a new object in Pace, get a model from the Pace client, set its properties, then call the save() method. You can retrieve a model instance by calling the model() method or using a dynamic property.

Reading an object

You can read an object by its primary key, which will return a single model.

Compound keys are separated by a colon.

Updating an object

In addition to creating objects, the save() method is used to update existing objects.

Duplicating an object

To duplicate an existing object, first load an existing object, optionally modify its properties, then call the duplicate() method. A new model instance will be returned and the existing model will be restored to its original state.

The duplicate() method accepts one optional argument: a new primary key value. If you do not supply a primary key, Pace will automatically increment in most cases.

Deleting an object

The delete() method accepts one optional argument: the name of the primary key for the model. If none is provided, it will be guessed.

Finding objects

Basics

Pace's web service uses XPath expressions to find objects. The included XPath\Builder class takes care of converting PHP native types and makes your filters more readable (in a PHP editor, anyway).

Finding mutiple objects

The above returns a collection of models.

Finding a single object

The above returns a single model instance.

Operators

All of the operators supported by Pace are supported by the client: =, !=, <, >, <=, >=. startsWith() and contains() are also supported.

Grouped filters

Sometimes you may need to group filters to create more complex conditions.

As you can see, passing a closure creates a nested set of conditions.

Sorting

Use the sort() method to sort your results. The sort() method accepts two arguments: an XPath expression identifying the field to sort on and a boolean to determine the direction, which has a default value of false (ascending). You can chain as many sorts as needed, although I'm not sure if Pace has a limit.

Dates

Dates are automatically converted to and from Carbon instances. Check out the Soap\DateTimeMapper and Soap\Factory classes if you want to see how this happens.

Key Collections

The raw result of a find objects SOAP call is an array of primary keys. The model class automatically wraps that array in a KeyCollection object to provide you with a bunch of conveniences, and to prevent unnecessary calls to the read object service by only loading models as they're needed.

You can loop over a KeyCollection like an array. Each model will be loaded as you interate over it, so if for example you break out of the loop, the remaining models will never have been loaded.

KeyCollection also has a number of useful methods such as all(), paginate() and first(). In fact, the single object find example from earlier is just a shortcut to the KeyCollection::first() method.

Relationships

Loading related models

You can load related models automatically via dynamic methods.

For a "belongs to" relationship, the model property name and foreign model type must match. For example, the Customer object has a property named 'csr', which contains the primary key for the 'CSR' object type.

The following returns a single Model.

To load "has many" related models, call the camel-cased plural of the foreign model's type. It is assumed that the foreign model stores the parent model's primary key in a propery named after the parent model's type. For example, the 'Job' object stores the 'Customer' object's primary key in a property named 'customer'.

The following returns an XPath\Builder object. You may optionally add additional filters on the related models.

If you find an object which flies in the face of convention, you can call the public belongsTo() and hasMany() methods directly.

The following two examples are the same.

In the first example, all of the required arguments are guessed. The second example explicitly provides them.

Compound keys

Initial support for loading related models with compound keys has been added. Call the hasMany() or belongsTo() methods, passing a string containing the field names (which contain the keys) separated by colons.

Associating related models

If the model you're associating has a guessable primary key, you can assign the model as a property value. Otherwise, you'll need to explicitly assign the primary key value.

Transactions

You can wrap your operations in a database transaction so that all calls may be rolled back in the event of an error. Using transactions has the added benefit of deferring any event handlers until all of your API calls are complete.

Note: The transaction service was introduced in Pace 29.0-1704.

Using a closure

Use the transaction() method to execute your operations in a database transaction. Pace will rollback the transaction in the event of a server-side error, and the API client will automatically rollback the transaction if a PHP exception is thrown. If the closure executes successfully, and there are no server-side errors, the transaction will be committed.

Using transactions manually

Alternatively, you can call the startTransaction(), rollbackTransaction() and commitTransaction() methods manually.

JSON

Both the Model and KeyCollection classes implement the JsonSerializable interface and casting either class to a string will generate JSON.

Attachments

Attaching files

To attach a file to a model, you only need to specify its name and content. The library takes care of guessing the MIME type and encoding the content.

The attachFile() method returns a FileAttachment model so you can set the category, description, etc. Only call the save() method if you change any attributes.

You can also attach a file to a field by specifying the name of the field. This is used throughout Pace for logos, photos, layouts, etc.

Retrieving attached files

Files attached to a model are retrieved via a special relationship method. It behaves the same as a "has many" relationship and returns an XPath\Builder instance.

Use a filter() to limit the results to one field or one type of file.

Finally, call getContent() on a FileAttachment model to read the content of the file. The library automatically decodes the content for you.

Reports

Fluently run reports using the report builder.

Passing parameters

Pass parameters to the report using the parameter() or namedParameter() methods. The parameter() method accepts two arguments: the report parameter ID and the value.

The namedParameter() method looks up the report parameter ID by its name.

Reports requiring a base object

Some reports require a base object. Use the baseObjectKey() method to pass a model or primary key.

Getting the report

The report builder get() method returns a Report\File instance, which has two public methods: getContent() returns the report file content and getMediaType() returns the media (MIME) type of the file.

Printing the report

Use the print() method to print the report to the default printer. If the report does not have a default printer configured, the Pace API will throw a SOAP error.

Version

Identify the version of Pace running on the server.

The above will return:


All versions of pace-api with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
ext-fileinfo Version *
ext-soap Version *
nesbot/carbon Version ^1.20 || ^2.0
doctrine/inflector Version ^1.4 || ^2.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 robgridley/pace-api contains the following files

Loading the files please wait ....