PHPackages                             echobot/angularphp - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. echobot/angularphp

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

echobot/angularphp
==================

A cross-platform AngularJS/PHP bridge

1.0.0(10y ago)1301[1 issues](https://github.com/echobot/angularphp/issues)MITPHP

Since Jul 22Pushed 10y ago2 watchersCompare

[ Source](https://github.com/echobot/angularphp)[ Packagist](https://packagist.org/packages/echobot/angularphp)[ RSS](/packages/echobot-angularphp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

AngularPHP
==========

[](#angularphp)

AngularPHP provides a bridge between PHP classes and AngularJS, by automatically exposing selected classes, methods &amp; properties as [AngularJS](https://angularjs.org/) services. Calls to these exported methods are routed to the same object on the server, with the result being passed back to the caller via a promise. Every instance of an exported class is automatically converted to and from its equivalent when passing through AngularPHP.

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

[](#installation)

Install via Composer:

```
composer require echobot/angularphp
```

Usage
-----

[](#usage)

In your project framework of choice, set up a route which passes the current request to AngularPHP and which renders the response. To assist in this, two utility classes exist which achieve this, depending on what framework you are using.

### [Laravel](http://laravel.com/)

[](#laravel)

The `Echobot\AngularPHP\Endpoints\Laravel` provides a Laravel-compatible endpoint, which can be easily used to create an AngularPHP endpoint on a particular route:

```
Echobot\AngularPHP\Endpoints\Laravel::create('/models.js')
        ->addDirectory(__DIR__ . '/models/')
        ->debug($debug);
```

That snippet serves up all exported classes in the `models` directory, from the route `/models.js`.

### PHP

[](#php)

The `Echobot\AngularPHP\Endpoints\PHPBuiltIn` class can be used to serve requests based on the `$_SERVER` global variable, which includes most old frameworks and PHP's built-in command-line web server.

### Other Frameworks

[](#other-frameworks)

One can use the `Echobot\AngularPHP\Endpoints\PHPBuiltIn` as an example to see how the endpoint class extends the `AngularPHP` class in order to improve the ease of use for a given framework. Using this example, creating a new endpoint for an unsupported framework should be relatively simple.

Example
-------

[](#example)

The following example defines an AngularPHP endpoint which exposes a single class (`ExampleClass`) in an AngularJS module called `ExampleModule`:

```
class ExampleClass
{
    /** @Export */
    public $property;

    /** @Export */
    public function someMethod($arg)
    {
        return 'Here is your argument: ' . $arg;
    }
}

Echobot\AngularPHP\Endpoints\PHPBuiltIn::create()
    ->setModuleName('ExampleModule')
    ->addClass('ExampleClass')
    ->run();
```

`Echobot\AngularPHP\Endpoints\PHPBuiltIn` is an endpoint which understands the standard PHP request representation (`$_SERVER`). An endpoint for [Laravel](http://laravel.com/) is also included in .

IDs
---

[](#ids)

AngularPHP allows the specification of one or more properties as containing the object's unique ID by adding `@Id` to the property's DocComment. Any object passing through AngularPHP with a known ID will return a reference to the existing object, allowing one object with a given ID to only exist once in AngularJS. For example, if you return a user twice from the backend, the second returned value will be a reference to the first, as they share an ID.

Read-Only Properties
--------------------

[](#read-only-properties)

By adding `@ReadOnly` to the DocComment of an exported property, the value of this property will not be passed back from the AngularJS module, and will not be updated on the specified object/class.

Inheritance
-----------

[](#inheritance)

AngularPHP strives to fully respect inheritance, provided the classes in the inheritance chain are also exported.

Security
--------

[](#security)

Beyond limiting access to exported methods &amp; properties, AngularPHP leaves security **entirely** up to you. This is a curse and a blessing - it's won't stop you doing what you want, but it's up to you to secure it.

Caution!
--------

[](#caution)

This code is relatively untested. We've had a lot of success with it, but one should be prepared for unintended behaviour. Any bug fixes will be gratefully received.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3953d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f316b91a2c8c6216fb1dd82a1a70fbccf710b112d0e8176edabf55ec3902934?d=identicon)[echobot](/maintainers/echobot)

---

Top Contributors

[![echobot](https://avatars.githubusercontent.com/u/13451520?v=4)](https://github.com/echobot "echobot (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/echobot-angularphp/health.svg)

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

###  Alternatives

[pcinaglia/laraupdater

LaraUpdater allows your Laravel application to auto-update itself.

17196.3k](/packages/pcinaglia-laraupdater)[gburtini/distributions

PHP implementation of a number of statistical probability distributions: normal, beta, gamma, etc.

59504.1k1](/packages/gburtini-distributions)[fergusean/nusoap

NuSOAP re-packaged for Packagist/Composer

281.3M10](/packages/fergusean-nusoap)

PHPackages © 2026

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