PHPackages                             cloudobjects/phpmae - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. cloudobjects/phpmae

ActiveLibrary[API Development](/categories/api)

cloudobjects/phpmae
===================

The PHP Micro API Engine.

1.0.0(6y ago)103[6 PRs](https://github.com/CloudObjects/phpMAE/pulls)MPL-2.0PHP

Since Apr 21Pushed 2y ago2 watchersCompare

[ Source](https://github.com/CloudObjects/phpMAE)[ Packagist](https://packagist.org/packages/cloudobjects/phpmae)[ Docs](https://github.com/CloudObjects/phpMAE)[ RSS](/packages/cloudobjects-phpmae/feed)WikiDiscussions main Synced 6d ago

READMEChangelog (3)Dependencies (18)Versions (10)Used By (0)

phpMAE
======

[](#phpmae)

[![Build Status](https://camo.githubusercontent.com/8fb151a3a696e623450bbcc817d8418a06b1e81a1f87f971ac6a6a6ecbc1835a/68747470733a2f2f7472617669732d63692e6f72672f436c6f75644f626a656374732f7068704d41452e7376673f6272616e63683d6d61696e)](https://travis-ci.org/CloudObjects/phpMAE) [![Join the chat at https://gitter.im/CloudObjects/phpMAE](https://camo.githubusercontent.com/18076b9c53ee724cfffd0b0e2e1782b496322748d9bad9504462116b7145f262/68747470733a2f2f6261646765732e6769747465722e696d2f436c6f75644f626a656374732f7068704d41452e737667)](https://gitter.im/CloudObjects/phpMAE?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

phpMAE, the *PHP* *M*icro *A*PI *E*ngine, is an opinionated serverless framework for the development, execution, and deployment of small-sized stateless Web APIs, so-called "Micro APIs".

The framework is partially built on top of the [Slim micro-framework](https://www.slimframework.com/) and leverages [PHPSandbox](https://phpsandbox.org/) to provide a safe runtime environment.

The configuration and source code for Micro APIs can be stored in [CloudObjects Core](https://cloudobjects.io/) and are deployed just-in-time to a running phpMAE instance via the [CloudObjects SDK](https://github.com/CloudObjects/CloudObjects-PHP-SDK) when a request for a specific API is received.

CloudObjects currently provides a preview release of a public hosted version of phpMAE. For development or if you wish to run your own Micro API engine, you can run phpMAE as a PHAR file, using our Docker container or directly from the source.

Installation
------------

[](#installation)

**Note:** The installation steps below were tested on *macOS*, which has PHP installed by default. If you are on Linux, you may have to install PHP through your distribution's package manager first. phpMAE has not yet been tested on Windows, but support is on the roadmap.

### PHAR

[](#phar)

This is the recommended installation method for developers to create, validate and deploy their Micro APIs.

You can grab the latest PHAR (PHp ARchive) from the [phpMAE Releases on GitHub](https://github.com/CloudObjects/phpMAE/releases).

Type `php phpmae.phar` to get a list of available CLI commands. Any commands or options that interact with CloudObjects require the [CloudObjects CLI Tool](https://cloudobjects.io/clitool) to be installed as a prerequisite.

To make the `phpmae` CLI tool globally available on your system run the following commands from the directory in which you downloaded `phpmae.phar`:

```
cp phpmae.phar /usr/local/bin/phpmae
chmod +x /usr/local/bin/phpmae

```

### Docker

[](#docker)

This is the recommended installation method if you want to run Micro APIs for staging and production on your own servers (local or cloud).

A prebuilt-image is available [from the Docker Hub](https://hub.docker.com/r/cloudobjects/phpmae/). You can download it via CLI:

```
docker pull cloudobjects/phpmae

```

When running the container you need to provide the *CO\_AUTH\_NS* and *CO\_AUTH\_SECRET* environment variables so that the phpMAE can authenticate itself against CloudObjects. Otherwise, only Micro APIs with [co:isVisibleTo](https://cloudobjects.io/cloudobjects.io/isVisibleTo) set to [co:Public](https://cloudobjects.io/cloudobjects.io/Public) can be run:

```
docker run -e CO_AUTH_NS=example.com -e CO_AUTH_SECRET=XXXXXXXX -p 8080:80 cloudobjects/phpmae

```

For *CO\_AUTH\_NS* use a domain that you have added to CloudObjects and that you want to use as the identity for this phpMAE instance. For *CO\_AUTH\_SECRET* you need to retrieve the shared secret between that domain and *cloudobjects.io*. You can retrieve this secret with the [CloudObjects CLI Tool](https://cloudobjects.io/clitool) using the following command:

```
cloudobjects domain-providers:secret example.com cloudobjects.io

```

### Source

[](#source)

This installation method is only recommended if you want to "look under the hood" of phpMAE or run with particular options.

You need to have [Composer](https://getcomposer.org) installed globally on your system to download and install the dependencies.

You can download or `git clone` this repository from GitHub, then run `composer install` (or `make`) to install dependencies.

It's recommended to use composer to download and install with a single command:

```
composer create-project cloudobjects/phpmae

```

You can customize your installation of phpMAE by copying `config.php.default` to `config.php` and then editing the file as per your requirements. Documentation of advanced features and configuration options will be published on the [phpMAE Wiki](https://github.com/CloudObjects/phpMAE/wiki).

phpMAE comes with unit tests. You can run them after installing the source to validate that any changes you made did not break the tests:

```
vendor/bin/phpunit

```

Getting Started Guide
---------------------

[](#getting-started-guide)

### Create a class

[](#create-a-class)

Micro APIs compatible with phpMAE are implemented as PHP classes. They are represented as objects on CloudObjects with the type [phpmae:Class](https://cloudobjects.io/phpmae.dev/Class). All public methods on these classes are made accessible via RPC protocols (currently [JSON-RPC](https://www.jsonrpc.org/specification)) and other classes that add your class as a dependency. If you want your class to expose a single entry point you can add [PHP's magic \_\_invoke()](https://secure.php.net/manual/en/language.oop5.magic.php#object.invoke) to it and make its object an instance of the type [phpmae:HTTPInvokableClass](https://cloudobjects.io/phpmae.dev/HTTPInvokableClass).

Like all objects, phpMAE classes are uniquely identified with COIDs (*C*loud *O*bject *ID*entifiers). COIDs are namespaced into domains, and you can create objects with COIDs only for domains that you have created or been assigned to in CloudObjects. You can see those domains in the [CloudObjects Dashboard](https://cloudobjects.io/dashboard).

To create a new class, choose a COID and then run the following command:

```
phpmae class:create --confjob coid://NAMESPACE/NAME/VERSION

```

If you want to create an HTTP-invokable class, add the option `--http-invokable`.

This command writes two files into the current directory, namely `NAME.VERSION.xml` and `NAME.VERSION.php`. The `.xml` file contains the basic object description for CloudObjects in RDF/XML format and the `.php` file contains the skeleton code for the PHP class. It also creates a configuration job to register the COID.

Open the `.php` file and start inserting your code.

### Validate and test locally

[](#validate-and-test-locally)

To check whether your code is valid PHP and also respects the constraints of phpMAE regarding whitelisted functions and classes run the following command:

```
phpmae class:validate coid://NAMESPACE/NAME/VERSION

```

You can add `--watch` to continuously watch for changes in the file and automatically revalidate.

To run your class, you can launch a local web server. Open a second terminal window or tab and run the following command:

```
phpmae testenv:start

```

The web server runs in the foreground and can be stopped with *Ctrl + C* (or *Cmd + C*). Go back to the first tab and run the following command:

```
phpmae class:testenv coid://NAMESPACE/NAME/VERSION

```

Apart from deploying your code to the local web server this command also prints out the base URL of your Micro API which you can then open in a browser or query from a tool such as `curl`. The `--watch` option is supported for continuous redeployment.

### Deploy your class

[](#deploy-your-class)

Use the following command to deploy your class:

```
phpmae class:deploy coid://NAMESPACE/NAME/VERSION

```

Internally, this command first validates the class, then calls the CloudObjects CLI to upload the `.php` source file as an attachment to CloudObjects Core and, if necessary, update the `.xml` file with a configuration job. Deployed classes are available for phpMAE instances within moments.

The output of the deploy command shows you the base URL of your Micro API on the public phpMAE instances. These instances require you to use HTTP Basic authentication to access your class. You have to use the namespace as the username, and the CloudObjects shared secret between that domain and *phpmae.dev* as the password. The command for retrieving this secret is shown to you as well.

### Use your class on custom instances

[](#use-your-class-on-custom-instances)

You can use your class on your own private instances as well. Start an instance,e.g., using Docker as described above, and replace *phpmae.dev* in the URL with our own instance's URL.

Help&amp;Support
----------------

[](#helpsupport)

Please join [our chat on Gitter](https://gitter.im/CloudObjects/phpMAE) and feel free to ask questions or provide feedback.

You can report bugs or suggest features through [our GitHub Issues](https://github.com/CloudObjects/phpMAE/issues). We also accept PRs with bug fixes; if you wish to contribute features, please create an issue first or discuss on chat. If you found a potential security issue, e.g., with the sandboxing feature, please do not use the public issue tracker but send an email to .

Make sure you follow the [CloudObjects Blog](https://blog.cloudobjects.io/) and [@CloudObjectsIO](https://twitter.com/CloudObjectsIO) for the latest updates, guides, and tutorials.

Commercial support and hosted private instances are available from [CloudObjects Consulting](https://cloudobjects.io/consulting).

License
-------

[](#license)

phpMAE is licensed under the Mozilla Public License (see LICENSE file).

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 99.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~501 days

Total

3

Last Release

2312d ago

Major Versions

0.2 → 1.0.02020-01-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d15a188ec9179b783d18fd516ef9caea2d16fc1cd5640ddcfa82ffd013beb41?d=identicon)[cloudobjects](/maintainers/cloudobjects)

---

Top Contributors

[![LukasRos](https://avatars.githubusercontent.com/u/192050?v=4)](https://github.com/LukasRos "LukasRos (288 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")

---

Tags

sandboxserverlessfaascloudobjectsmicroapi

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cloudobjects-phpmae/health.svg)

```
[![Health](https://phpackages.com/badges/cloudobjects-phpmae/health.svg)](https://phpackages.com/packages/cloudobjects-phpmae)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1537.5k](/packages/bacula-web-bacula-web)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
