PHPackages                             universaleducation/api - 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. universaleducation/api

ActiveLibrary[API Development](/categories/api)

universaleducation/api
======================

Enables PHP applications to communicate with the Universal Education API.

07PHPCI failing

Since May 11Pushed 6y ago2 watchersCompare

[ Source](https://github.com/TestBestEducationGroup/ue-php-sdk)[ Packagist](https://packagist.org/packages/universaleducation/api)[ RSS](/packages/universaleducation-api/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Universal Education API Client
==============================

[](#universal-education-api-client)

PHP client for connecting to the UniversalEducation V1 REST API.

Requirements
------------

[](#requirements)

- PHP 5.6 or greater
- cUrl extension enabled

**To connect to the API auth you need the following:**

- Secure URL pointing to a UniversalEducation
- API key for the user

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

[](#installation)

Use the following Composer command to install the API client from [the UniversalEducation vendor on Packagist](https://packagist.org/packages/UniversalEducation/api):

```
 $ composer require UniversalEducation/api
 $ composer update
```

You can also install composer for your specific project by running the following in the library folder.

```
 $ curl -sS https://getcomposer.org/installer | php
 $ php composer.phar install
 $ composer install
```

Namespace
---------

[](#namespace)

All the examples below assume the `UniversalEducation\Api\Client` class is imported into the scope with the following namespace declaration:

```
use UniversalEducation\Api\Client as UniversalEducation;
```

Configuration
-------------

[](#configuration)

To use the API client in your PHP code, ensure that you can access `UniversalEducation\Api`in your autoload path (using Composer’s `vendor/autoload.php` hook is recommended).

Provide your credentials to the static configuration hook to prepare the API client for connecting to a store on the UniversalEducation platform:

Auth
----

[](#auth)

```
UniversalEducation::configure(array(
    'api_key' => 'd81aada4xc34xx3e18f0xxxx7f36ca'
    'is_dev' => false //use true for test api
));
```

Accessing collections and resources (GET)
-----------------------------------------

[](#accessing-collections-and-resources-get)

To list all the resources in a collection:

```
$classes = UniversalEducation::getClasses('email');

foreach ($classes as $cl) {
    echo $cl->token;
}
```

To access a single resource and its connected sub-resources:

```
$product = UniversalEducation::getProduct(11);

echo $product->name;
echo $product->price;
```

To view the total count of resources in a collection:

```
$count = UniversalEducation::getProductsCount();

echo $count;
```

Updating existing resources (PUT)
---------------------------------

[](#updating-existing-resources-put)

To update a resource by passing an array or stdClass object of fields you want to change to the global update method:

```
$fields = array(
    "nick_name"  => "MacBook Air",
    "email" => "john.doe@example.com",
);

UniversalEducation::updateUser($fields);
```

Creating new resources (POST)
-----------------------------

[](#creating-new-resources-post)

Some resources support creation of new items by posting to the collection. This can be done by passing an array or stdClass object representing the new resource to the global create method:

```
$fields = array(
    "last_name" => "Doe",
    "first_name" => "John",
    "password" => "Apple",
    "email" => "john.doe@example.com",
);

UniversalEducation::createUser($fields);
```

You can also create a resource by making a new instance of the resource class and calling the create method once you have set the fields you want to save:

```
$user = new UniversalEducation\Api\Resources\User();

$user->last_name = "Doe";
$user->first_name = "John";
$user->password = "Apple";
$user->email = "john.doe@example.com";
$user->create();
```

Handling Errors And Timeouts
----------------------------

[](#handling-errors-and-timeouts)

For whatever reason, the HTTP requests at the heart of the API may not always succeed.

Every method will return false if an error occurred, and you should always check for this before acting on the results of the method call.

In some cases, you may also need to check the reason why the request failed. This would most often be when you tried to save some data that did not validate correctly.

```
$user = UniversalEducation::getUser();

if (!$orders) {
    $error = UniversalEducation::getLastError();
    echo $error->code;
    echo $error->message;
}
```

Returning false on errors, and using error objects to provide context is good for writing quick scripts but is not the most robust solution for larger and more long-term applications.

An alternative approach to error handling is to configure the API client to throw exceptions when errors occur. Bear in mind, that if you do this, you will need to catch and handle the exception in code yourself. The exception throwing behavior of the client is controlled using the failOnError method:

```
UniversalEducation::failOnError();

try {
    $orders = UniversalEducation::getOrders();

} catch(UniversalEducation\Api\Error $error) {
    echo $error->getCode();
    echo $error->getMessage();
}
```

The exceptions thrown are subclasses of Error, representing client errors and server errors. The API documentation for response codes contains a list of all the possible error conditions the client may encounter.

Verifying SSL certificates
--------------------------

[](#verifying-ssl-certificates)

By default, the client will attempt to verify the SSL certificate used by the UniversalEducation store. In cases where this is undesirable, or where an unsigned certificate is being used, you can turn off this behavior using the verifyPeer switch, which will disable certificate checking on all subsequent requests:

```
UniversalEducation::verifyPeer(false);
```

Connecting through a proxy server
---------------------------------

[](#connecting-through-a-proxy-server)

In cases where you need to connect to the API through a proxy server, you may need to configure the client to recognize this. Provide the URL of the proxy server and (optionally) a port to the useProxy method:

```
UniversalEducation::useProxy("http://proxy.example.com", 81);
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6333629?v=4)[Jonathan L Herr](/maintainers/JonHerr)[@JonHerr](https://github.com/JonHerr)

---

Top Contributors

[![JonHerr](https://avatars.githubusercontent.com/u/6333629?v=4)](https://github.com/JonHerr "JonHerr (3 commits)")

### Embed Badge

![Health badge](/badges/universaleducation-api/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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