PHPackages                             theninthnode/defaqto - 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. theninthnode/defaqto

ActiveLibrary[API Development](/categories/api)

theninthnode/defaqto
====================

PHP package for interacting with the Defaqto.io API.

04PHP

Since Mar 6Pushed 12y ago1 watchersCompare

[ Source](https://github.com/theninthnode/defaqto-php)[ Packagist](https://packagist.org/packages/theninthnode/defaqto)[ RSS](/packages/theninthnode-defaqto/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

DefaqtoIO PHP Client
====================

[](#defaqtoio-php-client)

DefaqtoIO PHP Client is a PHP package for using the [DefaqtoIO](http://defaqto.io) CMS service.

\##Installation

### Composer

[](#composer)

Add the library to your composer.json file

```
"theninthnode/defaqto": "dev-master"

```

Run `composer install` to get the latest version of the package.

### Manually

[](#manually)

It's recommended that you use Composer, however you can download and install from this repository.

Please note. This client requires the Guzzle REST PHP package.

### Laravel 4

[](#laravel-4)

This package comes with a Service Provider and Facade for easy integration with Laravel4.

1. Add the following entry to the `providers` array in config/app.php

    'TheNinthNode\\Defaqto\\DefaqtoServiceProvider'
2. Add the following entry to the `aliases` array in config/app.php

    'Defaqto' =&gt; 'TheNinthNode\\Defaqto\\Facades\\Defaqto',

\##Usage

1. Register your account at [defaqto.io](http://defaqto.io).
2. Log in and create your first app by clicking the "+ Create New App" button.
3. In your new app click "Settings" from the left menu.
4. Take note of the the App ID and Access Token.
5. Create a test page.

After installing the package you can use it like this:

```
$pages = Defaqto::setup($app_id, $access_token)->get('pages');
var_dump($pages);

```

NOTE. If you get a class not found error load the class in with:

```
use TheNinthNode\Defaqto\Defaqto;

```

OR

```
$pages = TheNinthNode\Defaqto\Defaqto::setup($app_id, $access_token)->get('pages');

```

You can use the class with the following syntax:

```
$html = Defaqto::setup($app_id, $access_token)->get('resource', array('key'=>'value'));

```

Where `resource` is one of `pages`, `blocks`, `variables`, `blog/posts`, `blog/categories`, `blog/tags`, `blog/authors`.

The second (optional) param is an array of key=&gt;value pairs known as attributes. ie. `array('page_slug'=>'about-us')`

Each resource has the following optional params:

- order - field to use for sorting
- dir - direction to sort ASC or DESC
- limit - limit the amount of results
- offset - number of results to skip

There is a third optional param for use with the blog/posts resource. This is an array of resources to exclude (tags, categories, authors)

\##Examples

### Pages

[](#pages)

resource: `pages`

Params:

- page\_id
- page\_slug

To get all pages:

```
$pages = Defaqto::setup($app_id, $access_token)->get('pages');
var_dump($pages);

```

To get a page by `page_slug`

```
$page = Defaqto::setup($app_id, $access_token)->get('pages', array('page_slug'=>'about-us'));
echo $page['title'];

```

### HTML Blocks

[](#html-blocks)

resource: `blocks`

Params:

- block\_id

To get all blocks:

```
$blocks = Defaqto::setup($app_id, $access_token)->get('blocks');
var_dump($blocks);

```

To get a block by `block_id`

```
$block = Defaqto::setup($app_id, $access_token)->get('blocks', array('block_id'=>1234));
echo $block['content'];

```

### Variables

[](#variables)

resource: `variables`

Params:

- key

To get all variables:

```
$variables = Defaqto::setup($app_id, $access_token)->get('variables');
var_dump($variables);

```

To get a variable by it's `key`

```
$variable = Defaqto::setup($app_id, $access_token)->get('variables', array('key'=>'pricing'));
echo $variable['value'];

```

### Blog posts

[](#blog-posts)

resource: `blog/posts`

Params:

- post\_id
- post\_slug
- category\_slug
- tag\_slug
- status - draft|published (defaults to published)

To get all (published) posts:

```
$posts = Defaqto::setup($app_id, $access_token)->get('blog/posts');
var_dump($posts);

```

To get a post by it's `post_slug`

```
$post = Defaqto::setup($app_id, $access_token)->get('blog/posts', array('post_slug'=>'hello-world'));
echo $post['title'];

```

To get all posts by tag (`tag_slug`)

```
$posts = Defaqto::setup($app_id, $access_token)->get('blog/posts', array('tag_slug'=>'javascript'));
var_dump($posts);

```

To get all posts without their authors, tags, or categories

```
$posts = Defaqto::setup($app_id, $access_token)->get('blog/posts', array(), array('authors', 'tags', 'categories'));

```

### Blog categories

[](#blog-categories)

resource: `blog/categories`

Params:

- category\_id
- category\_slug

To get all categories:

```
$cats = Defaqto::setup($app_id, $access_token)->get('blog/categories');
var_dump($cats);

```

To get a category by it's slug

```
$category = Defaqto::setup($app_id, $access_token)->get('blog/categories', array('category_slug'=>'announcements'));
echo $category['name'];

```

### Blog tags

[](#blog-tags)

resource: `blog/tags`

Params:

- tag\_id
- tag\_slug

To get all tags:

```
$tags = Defaqto::setup($app_id, $access_token)->get('blog/tags');
var_dump($tags);

```

To get a tag by it's slug

```
$tag = Defaqto::setup($app_id, $access_token)->get('blog/tags', array('tag_slug'=>'javascript'));
echo $tag['name'];

```

### Blog authors

[](#blog-authors)

resource: `blog/authors`

Params:

- author\_id
- username

To get all authors:

```
$authors = Defaqto::setup($app_id, $access_token)->get('blog/authors');
var_dump($authors);

```

To get an author by their username

```
$author = Defaqto::setup($app_id, $access_token)->get('blog/authors', array('username'=>'jonesy'));
echo $author['bio'];

```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

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://www.gravatar.com/avatar/16a012b5989cfb32a0ce6ef86d37e9e4d6525a4909c953d037d01c80b214d24a?d=identicon)[theninthnode](/maintainers/theninthnode)

---

Top Contributors

[![theninthnode](https://avatars.githubusercontent.com/u/912279?v=4)](https://github.com/theninthnode "theninthnode (8 commits)")

### Embed Badge

![Health badge](/badges/theninthnode-defaqto/health.svg)

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

###  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)
