PHPackages                             optretina/optretina-php-sdk - 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. optretina/optretina-php-sdk

ActiveProject[API Development](/categories/api)

optretina/optretina-php-sdk
===========================

OPTretina SDK is a PHP client library to work with OPTRETINA REST API

025PHP

Since Aug 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Optretina/optretina-php-sdk)[ Packagist](https://packagist.org/packages/optretina/optretina-php-sdk)[ RSS](/packages/optretina-optretina-php-sdk/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![](https://camo.githubusercontent.com/19f62c35c3d6c1d733766864352420caa4cd7cb79a8451f8f09f89c498608085/687474703a2f2f7777772e6f7074726574696e612e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031342f31312f6c6f676f2d6f7074726574696e612e706e67)](https://camo.githubusercontent.com/19f62c35c3d6c1d733766864352420caa4cd7cb79a8451f8f09f89c498608085/687474703a2f2f7777772e6f7074726574696e612e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031342f31312f6c6f676f2d6f7074726574696e612e706e67)

The OPTRETINA REST API package is meant to provide you, the developer, with a set of tools to help you easily and quickly build your own system based in our API. Remember the the API still won't cover all situations and features that our platform offers.

Features
========

[](#features)

This package provides tools for the following:

- Authentication
- Retrieve a list of cases
- Get a single case
- Get a report for a specific case
- Create a new case

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

[](#installation)

Install the latest version with

```
$ composer require optretina/optretina-php-sdk
```

Authentication
--------------

[](#authentication)

The OAuth2 authorization method.

### Request

[](#request)

- HTTP Method: POST
- URL:
- Params: \[ client\_id, client\_secret, grant\_type="client\_credentials" \]
- Return: access\_token

### Example

[](#example)

```
#!bash
curl -H 'Content-Type: application/json' -X POST -d '{"client_id": "XXXXX", "client_secret": "XXXX", "grant_type":"client_credentials"}' https://api.optretina.com/authorize

```

### Example with SDK

[](#example-with-sdk)

```
#!php

define("CLIENT_ID", "CLIENT_ID_XXX");
define("CLIENT_SECRET", "CLIENT_SECRET_XXX");

$client = new Optretina\Api\Client(CLIENT_ID, CLIENT_SECRET);

```

Documentation
=============

[](#documentation)

List of cases
-------------

[](#list-of-cases)

Retrieve all cases.

### Request

[](#request-1)

- Requires authentication
- HTTP Method: GET
- URL:

### Example

[](#example-1)

```
#!php

define("CLIENT_ID", "CLIENT_ID_XXX");
define("CLIENT_SECRET", "CLIENT_SECRET_XXX");

$client = new Optretina\Api\Client(CLIENT_ID, CLIENT_SECRET);
$response = $client->getCases();

```

Get case
--------

[](#get-case)

Get a particular case

### Request

[](#request-2)

- Requires authentication
- HTTP Method: GET
- URL: [https://api.optretina.com/cases/{id}](https://api.optretina.com/cases/%7Bid%7D)

### Example

[](#example-2)

```
#!php

define("CLIENT_ID", "CLIENT_ID_XXX");
define("CLIENT_SECRET", "CLIENT_SECRET_XXX");
define("CASE_ID", "XXXX");

$client = new Optretina\Api\Client(CLIENT_ID, CLIENT_SECRET);
$response = $client->getCase(CASE_ID);

```

Get a report
------------

[](#get-a-report)

Get a report for a specific case. Output as code string in base64.

### Request

[](#request-3)

- Requires authentication
- HTTP Method: GET
- URL: [https://api.optretina.com/cases/report/{id}](https://api.optretina.com/cases/report/%7Bid%7D)

### Example

[](#example-3)

```
#!php

define("CLIENT_ID", "CLIENT_ID_XXX");
define("CLIENT_SECRET", "CLIENT_ID_XXX");
define("CASE_ID", 'XXXX');

$client = new Optretina\Api\Client(CLIENT_ID, CLIENT_SECRET);
$response = $client->getReport(CASE_ID);

/*
    Response:
    - success: true or false
    - content: if success = true -> File source decode in base64 . Otherwise error message.
*/
if ($response->success) {
    header('Content-Type: application/pdf');
    header('Cache-Control: public, must-revalidate, max-age=0');
    header('Pragma: public');
    header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
    echo base64_decode($response->content);
    die();
}

```

Create case
-----------

[](#create-case)

Create a new case.

### Request

[](#request-4)

- Requires authentication
- HTTP Method: POST
- URL:

### Example

[](#example-4)

```
#!php

define("CLIENT_ID", "CLIENT_ID_XXX");
define("CLIENT_SECRET", "CLIENT_SECRET_XXX");

define("MALE", 0);
define("FEMALE", 1);

$client = new Optretina\Api\Client(CLIENT_ID, CLIENT_SECRET);

$response = $client->createCase([
    'history_number' => 31415,
    'first_name' => 'API Name',
    'last_name' => 'Last Name',
    'gender' => FEMALE, // 0: MALE, 1: FEMALE
    'age' => 30,
    'diabetes' => 1, // 0: no, 1: yes
    'visit_date' => (new \DateTime('now'))->format('Y-m-d'), // A date accepted by PHP DateTime constructor
    'visit_reason' => 'Patient with regular headaches when reading',
    'ophthalmic_antecedents' => 'Relevant antecedents',
    'other_relevant_info' => 'Other',
    'retinologist_notes' => 'Internal notes for the retinologist',
    'od_iop' => 16,
    'od_va' => 0.5,
    'od_axis' => 15,
    'od_cylinder' => -1,
    'od_sphere' => -1.25,
    'od_add' => 3.5,
    'od_prism' => 0.5,
    'od_prism_base' => 0, // 0: down, 1: up
    'os_iop' => 16,
    'os_va' => 0.5,
    'os_axis' => 15,
    'os_cylinder' => -1,
    'os_sphere' => -1.25,
    'os_add' => 3.5,
    'os_prism' => 0.5,
    'os_prism_base' => 0,
    'description' => 'campoNoMapeado1: valorCampo1; campoNoMapeado2: valorCampo2; campoNoMapeado3: valorCampo3;',
    'callback_url' => 'http://localhost.com/optretina-php-sdk/example/callback.php', // POST CALL when case is reported or rejected
    'images' => array(
        './images/2.jpg', //Local path
    )
]);

```

Callback and notifications
--------------------------

[](#callback-and-notifications)

A good way to get informed about different case status is to use a callback URL when case is created.

All notifications come in as a POST request.

### Available notifications.

[](#available-notifications)

- When a case is informed
- When a case is informed but the report has been modified.
- When a case is rejected

```
#!php
$_POST['status'] contains the new status, could be "reported" or "reject"
$_POST['caso'] contains the caso id.
$_POST['derivation'] values normal, routine, preferential, urgent

```

Getting Help
------------

[](#getting-help)

We've done our best to write the OPTRETINA API documentation to make integrating with it as simple as possible. Should you have questions, [contact us](mailto:info@optretina.com).

Help us make it better
----------------------

[](#help-us-make-it-better)

Please tell us how we can make the API better. If you have a specific feature request or if you found a bug, please use GitHub issues.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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/1397384?v=4)[ALM](/maintainers/lopezmuzas)[@lopezmuzas](https://github.com/lopezmuzas)

---

Top Contributors

[![lopezmuzas](https://avatars.githubusercontent.com/u/1397384?v=4)](https://github.com/lopezmuzas "lopezmuzas (12 commits)")

### Embed Badge

![Health badge](/badges/optretina-optretina-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/optretina-optretina-php-sdk/health.svg)](https://phpackages.com/packages/optretina-optretina-php-sdk)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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