PHPackages                             nglasl/silverstripe-apiwesome - 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. nglasl/silverstripe-apiwesome

AbandonedArchivedSilverstripe-module[API Development](/categories/api)

nglasl/silverstripe-apiwesome
=============================

A module for SilverStripe which will automatically create customisable JSON/XML feeds for your data objects (including pages), and provides a modular security token that can be used for other applications.

2.2.15(8y ago)135182BSD-3-ClausePHP

Since Nov 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/nglasl/silverstripe-apiwesome)[ Packagist](https://packagist.org/packages/nglasl/silverstripe-apiwesome)[ Docs](https://github.com/nglasl/silverstripe-apiwesome)[ RSS](/packages/nglasl-silverstripe-apiwesome/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (2)Versions (35)Used By (0)

[apiwesome](https://packagist.org/packages/nglasl/silverstripe-apiwesome)
=========================================================================

[](#apiwesome)

*The current release is **2.2.15***

> A module for SilverStripe which will automatically create customisable JSON/XML feeds for your data objects (including pages), and provides a modular security token that can be used for other applications.

Requirement
-----------

[](#requirement)

- SilverStripe 3.0 → **3.5**

This module is **no longer supported**.

Getting Started
---------------

[](#getting-started)

- [Place the module under your root project directory.](https://packagist.org/packages/nglasl/silverstripe-apiwesome)
- Define any custom JSON/XML data object exclusions/inclusions through project configuration.
- `/dev/build`
- Select `JSON/XML` through the CMS.
- Configure attribute visibility.
- `Regenerate` the security token `x:y`
- `/apiwesome/retrieve/data-object-name/json?token=x:y`
- `/apiwesome/retrieve/data-object-name/xml?token=x:y`

Overview
--------

[](#overview)

### Data Object Exclusions/Inclusions

[](#data-object-exclusionsinclusions)

ALL data objects are included by default (excluding some core), unless disabled or inclusions have explicitly been defined.

```
DataObjectOutputConfiguration::customise_data_objects('exclude', array(
	'DataObjectName'
));
```

```
DataObjectOutputConfiguration::customise_data_objects('include', array(
	'DataObjectName'
));
```

To completely disable the JSON/XML:

```
DataObjectOutputConfiguration::customise_data_objects('disabled');
```

### Attribute Visibility Customisation

[](#attribute-visibility-customisation)

[![visibility](https://raw.githubusercontent.com/nglasl/silverstripe-apiwesome/master/images/apiwesome-visibility.png)](https://raw.githubusercontent.com/nglasl/silverstripe-apiwesome/master/images/apiwesome-visibility.png)

The JSON/XML feed will only be available to data objects with attribute visibility set through the CMS. Any `has_one` relationships may be displayed, where attribute visibility is determined recursively.

#### Recursive Relationships

[](#recursive-relationships)

These are enabled by default, however will greatly impact performance if many nested relationships are visible.

To disable the recursion:

```
Injector:
  APIwesomeService:
    properties:
      recursiveRelationships: false
```

### Security Token

[](#security-token)

A JSON/XML feed request will require the current security token passed through, where this may be regenerated by an administrator (invalidating the previous security token).

[![token](https://raw.githubusercontent.com/nglasl/silverstripe-apiwesome/master/images/apiwesome-token.png)](https://raw.githubusercontent.com/nglasl/silverstripe-apiwesome/master/images/apiwesome-token.png)

The security token generation (and validation) is modular, and can still be used when the JSON/XML is completely disabled (more below):

```
SecurityAdmin:
  extensions:
    - 'APIwesomeTokenExtension'
```

### Output

[](#output)

A JSON/XML feed request may have a number of optional filters applied, where the `&filter` will only apply to visible attributes:

- `&limit=5`
- `&sort=Attribute,ORDER`
- `&filter1=value`
- `&filter2=value`

It may also be previewed through the appropriate model admin of your data object.

[![preview](https://raw.githubusercontent.com/nglasl/silverstripe-apiwesome/master/images/apiwesome-preview.png)](https://raw.githubusercontent.com/nglasl/silverstripe-apiwesome/master/images/apiwesome-preview.png)

#### Pretty JSON

[](#pretty-json)

This is enabled by default, however will slightly impact performance if many nested relationships are visible.

To disable the pretty printing:

```
Injector:
  APIwesomeService:
    properties:
      prettyJSON: false
```

### Developer Functionality

[](#developer-functionality)

#### PHP

[](#php)

Accessing the service:

```
$service = Singleton('APIwesomeService');
```

The methods available may be programmatically called to generate JSON, with optional filters:

```
$JSON = $service->retrieve('DataObjectName', 'JSON');
$JSON = $service->retrieve('DataObjectName', 'JSON', 5, array(
	'Attribute',
	'ORDER'
), array(
	'Attribute1' => 'value',
	'Attribute2' => 'value'
));
```

```
$objects = DataObjectName::get()->toNestedArray();
$JSON = $service->retrieveJSON($objects);
```

XML, with optional filters:

```
$XML = $service->retrieve('DataObjectName', 'XML');
$XML = $service->retrieve('DataObjectName', 'XML', 5, array(
	'Attribute',
	'ORDER'
), array(
	'Attribute1' => 'value',
	'Attribute2' => 'value'
));
```

```
$objects = DataObjectName::get()->toNestedArray();
$XML = $service->retrieveXML($objects);
```

JSON/XML for a versioned page (though the CMS may not correctly preview XML), with regard to the respective stage in `index()`:

```
return $service->retrieveStaged($this->data()->ID, 'JSON');
```

They may also be used to parse JSON/XML from another APIwesome instance. Therefore, this module may be used as both an API and external connector between multiple projects.

```
$objects = $service->parseJSON($JSON);
```

```
$objects = $service->parseXML($XML);
```

The security token validation (and generation) is modular, and can be used for other applications (more above):

```
$validation = $service->validateToken($this->getRequest()->getVar('token'));
switch($validation) {
	case APIwesomeService::VALID:

		// The token matches the current security token.

		break;
	case APIwesomeService::INVALID:

		// The token does not match a security token.

		break;
	case APIwesomeService::EXPIRED:

		// The token matches a previous security token.

		break;
}
```

#### jQuery

[](#jquery)

JSON example:

```
;(function($) {
	$(function() {

		$.getJSON('//ss3.1/apiwesome/retrieve/data-object-name/json?token=' + token(), function(JSON) {

			// Iterate over each data object.

			if(JSON['APIwesome'] !== undefined) {
				$.each(JSON['APIwesome']['DataObjects'], function(index, object) {

					// The JSON feed security token is no longer valid!

					if((index === 'Expired') && (object === true)) {
						return false;
					}

					// Iterate over each visible attribute.

					$.each(object, function(type, attributes) {
						$.each(attributes, function(attribute, value) {
						});
						break;
					});
				});
			}
		})

		// The JSON feed has either not yet been configured, or no data objects were found.

		.fail(function() {
		});

	});
})(jQuery);
```

Maintainer Contact
------------------

[](#maintainer-contact)

```
Nathan Glasl, nathan@symbiote.com.au

```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity75

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

Every ~34 days

Recently: every ~83 days

Total

34

Last Release

3088d ago

Major Versions

1.2.3 → 2.0.02015-05-27

1.2.x-dev → 2.0.12015-07-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/43c7ada3a1cee7f9d6074198a3b28cda0cebe515c6178716d11adc8ddb580b16?d=identicon)[nglasl](/maintainers/nglasl)

---

Top Contributors

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

---

Tags

apifeedjsonsilverstripexmljsonapixmlfeedsilverstripe

### Embed Badge

![Health badge](/badges/nglasl-silverstripe-apiwesome/health.svg)

```
[![Health](https://phpackages.com/badges/nglasl-silverstripe-apiwesome/health.svg)](https://phpackages.com/packages/nglasl-silverstripe-apiwesome)
```

###  Alternatives

[nathanmac/parser

Simple PHP Parser Utility Library for API Development

2121.0M3](/packages/nathanmac-parser)[nilportugues/api-problems

PSR7 Response implementation for the Problem Details for HTTP APIs

1749.5k2](/packages/nilportugues-api-problems)

PHPackages © 2026

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