Download the PHP package lullabot/mpx-php without Composer

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

mpx for PHP

CircleCI Maintainability Test Coverage Packagist

Table of Contents generated with DocToc

Quick Start

composer require lullabot/mpx-php

Example

Here is a complete example showing how to load an account and media items from mpx. Most implementations should not contain all of this code in a single class. Instead, create functions, classes, or services to bridge the clients, caches, and locks into your application. For an example of how to do this, see the media_mpx module for Drupal 8.

A runnable version of this code is in a test at \Lullabot\Mpx\Tests\Functional\ReadmeTest::testExample().

Implemented Data Services

The mpx API is very broad, and this library only implements a subset of the whole API. However, pull requests with new data services are always welcome. As well, data services are discovered through annotations, so they can be included from other libraries as needed.

Data Service Object Schema Version Implementation Tests
Account 1.0 \Lullabot\Mpx\DataService\Access\Account \Lullabot\Mpx\Tests\Unit\DataService\Access\AccountTest
\Lullabot\Mpx\Tests\Functional\DataService\Account\AccountQueryTest
Feed Config 2.2 \Lullabot\Mpx\DataService\Feeds\FeedConfig \Lullabot\Mpx\Tests\Unit\DataService\Feeds\FeedConfigTest
\Lullabot\Mpx\Tests\Functional\DataService\Feeds\FeedConfigTest
Media 1.10 \Lullabot\Mpx\DataService\Media\Media \Lullabot\Mpx\Tests\Unit\DataService\Media\MediaTest
\Lullabot\Mpx\Tests\Functional\DataService\Media\MediaQueryTest
Media File 1.10 \Lullabot\Mpx\DataService\Media\MediaFile \Lullabot\Mpx\Tests\Unit\DataService\Media\MediaFileTest
\Lullabot\Mpx\Tests\Functional\DataService\Media\MediaFileTest
Release 1.10 \Lullabot\Mpx\DataService\Media\Release \Lullabot\Mpx\Tests\Unit\DataService\Media\ReleaseTest
Player 1.6 \Lullabot\Mpx\DataService\Player\Player \Lullabot\Mpx\Tests\Unit\DataService\Player\PlayerTest
\Lullabot\Mpx\Tests\Functional\DataService\Player\PlayerQueryTest

Filtering results by fields and with Q Queries

Calls to select() and selectRequest() can be filtered by exact-match fields as well as with more complex searches.

Test client

thePlatform provides a Media Data Service Web Client that can be used for quick testing of Media Data Service APIs. Unfortunately, the client can not be used for other data service APIs. To test those, see the functional tests in tests/src/Functional and the configuration in phpunit.xml.dist.

Logging

This library will log API actions that are transparent to the calling code. For example, calling code should handle logging of invalid credentials, while this library will log if an authentication was automatically refreshed during an API request that resulted in a 401.

If your application does not wish to log these actions at all, use \Psr\Log\NullLogger for any constructors that require a \Psr\Log\LoggerInterface.

Implementing custom mpx fields

mpx data service objects can have up to 100 custom fields defined per account. These fields can contain a variety of data types, with multiple namespaces of custom fields applying to a single object. This library allows for developers to create structured classes in their own application code that are discovered and used automatically.

1. Use the console tool to create initial classes

This CLI tool uses the mpx Field API to generate matching classes. Consider adding descriptions for each custom field in mpx, as these will be used automatically in doc comments. Run bin/console help mpx:create-custom-field for up-to-date documentation on this command.

For example, to generate classes for all custom fields attached to a Media object:

  1. Clone this repository.
  2. $ composer install
  3. $ bin/console mpx:create-custom-field 'Php\Namespace\For\These\Classes' 'Media Data Service' 'Media' '1.10'
  4. Enter your username and password. Progress will be shown for each field that is found.

As the mpx API has no data useful in creating class names, classes for each field namespace will be created with names like CustomFieldClassOne.php. It is highly suggested that these classes are renamed to match the fields they contain.

Each generated class will contain an @CustomField annotation:

This is what the library uses to determine which class corresponds to a given namespace. Note that custom fields do not have schema versions. Be careful when deleting or changing data types on existing fields.

These custom fields should live in your application code. As such, you will need to provide a way to discover the classes since different applications have different source code structures. If you're using a module for a CMS like Drupal, it should already provide that functionality. If not, see \Lullabot\Mpx\DataService\CustomFieldManager::basicDiscovery for an example that can be adapted in many cases.

Once the classes are available, they will be automatically used when loading mpx objects. For example, to retrieve fields for the above namespace on a Media object, call:

If a custom field class is not found, a notice will be logged and the empty MissingCustomFieldsClass will be attached in place of each set of fields.

Related Projects

Overview of main classes

Lullabot\Mpx\Client

mpx API implementation of GuzzleHttp\ClientInterface. As a Client it doesn’t do anything extra but suppress errors to force a returning HTTP 200 for XML responses. It also handles XML from responses.

Lullabot\Mpx\AuthenticatedClient

Manages authenticated sessions and proxies API calls with a ClientInterface implementation, automatically refreshing expired API tokens as required.

Lullabot\Mpx\Service\IdentityManagement\UserSession

An mpx user. Just username and password getters.

Lullabot\Mpx\Token

mpx authentication token that is returned by the platform after sign in.

Lullabot\Mpx\TokenCachePool

Cache of user authentication tokens. This class is a wrapper around a \Psr\Cache\CacheItemPoolInterface object.

mpx Support

This library is not supported by thePlatform. If you need help with the library, open an issue here in GitHub. If you need help with the mpx service itself, see the mpx support portal to file a support request.

Known issues

#2001 in Guzzle forces processing notifications to load all objects that have been notified. Consider applying that patch with composer-patches until a new release is out.


All versions of mpx-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
guzzlehttp/guzzle Version ^6.3 || ^7.4.5
guzzlehttp/psr7 Version ^2
psr/log Version ^1.0 || ^3.0
symfony/cache Version ^6
symfony/serializer Version ^6
symfony/property-access Version ^6
doctrine/annotations Version ^1.2
symfony/property-info Version ^6
symfony/lock Version ^6
symfony/finder Version ^6
phpdocumentor/reflection-docblock Version ^5.2
psr/http-message Version ^1.0
psr/simple-cache Version ^3.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 lullabot/mpx-php contains the following files

Loading the files please wait ....