ORANGECOLLAR/MODULE-WORDPRESS-INTEGRATION · API REFERENCE
PHP API reference for ClientInterface, data models, and PostRepositoryInterface
ClientInterface
All WordPress API calls go through OrangeCollar\WordPressIntegration\Model\Api\ClientInterface. Never call Guzzle directly from outside the client implementation.
interface ClientInterface
{
// Posts
public function getPosts(array $params = []): array;
public function getPost(int $id): array;
public function getPostBySlug(string $slug): ?array;
// Categories
public function getCategories(array $params = []): array;
public function getAllCategories(): array;
public function getCategory(int $id): array;
public function getCategoryBySlug(string $slug): ?array;
// Tags
public function getTags(array $params = []): array;
public function getAllTags(): array;
public function getTag(int $id): array;
public function getTagBySlug(string $slug): ?array;
// Media
public function getMedia(int $id): array;
// Menus (oc-bridge endpoints)
public function getMenu(string $locationOrSlug): array;
public function getMenus(): array;
// SEO (oc-bridge endpoint)
public function getSeoMeta(int $postId): array;
// Authors
public function getAuthor(int $id): array;
public function getAuthorBySlug(string $slug): ?array;
// Search and related
public function searchPosts(string $query, int $page = 1): array;
public function getRelatedPosts(int $postId, int $count = 5): array;
} Methods returning array return the raw WP REST API response (already JSON-decoded). Methods returning ?array return null when no result is found (e.g., slug not matched).
Post Data Model
OrangeCollar\WordPressIntegration\Model\Post
| Property | Type | Source |
|---|---|---|
id | int | id |
slug | string | slug |
title | string | title.rendered |
content | string | content.rendered (after ContentProcessor) |
excerpt | string | excerpt.rendered |
status | string | status |
date | DateTimeImmutable | date |
modified | DateTimeImmutable | modified |
authorId | int | author |
authorName | string | _ |
authorSlug | string | _ |
featuredMediaId | int | featured_ |
featuredImageUrl | string | _ |
categories | array | _ (category terms) |
tags | array | _ (tag terms) |
commentCount | int | comment_ |
acfFields | array | acf (if ACF plugin active) |
Category Data Model
OrangeCollar\WordPressIntegration\Model\Category
| Property | Type | Description |
|---|---|---|
id | int | WP category ID |
name | string | Category display name |
slug | string | URL slug |
description | string | Category description |
count | int | Post count |
parentId | int | Parent category ID (0 if top-level) |
Tag Data Model
OrangeCollar\WordPressIntegration\Model\Tag
| Property | Type | Description |
|---|---|---|
id | int | WP tag ID |
name | string | Tag display name |
slug | string | URL slug |
count | int | Post count |
Menu Data Model
OrangeCollar\WordPressIntegration\Model\Menu
| Property | Type | Description |
|---|---|---|
id | int | WP menu ID |
name | string | Menu name |
slug | string | Menu slug |
items | array | Nested array of menu items |
PostRepositoryInterface
interface PostRepositoryInterface
{
public function getList(int $page = 1, int $perPage = 10): array;
public function getBySlug(string $slug): ?Post;
public function getById(int $id): ?Post;
public function getByCategory(string $slug, int $page = 1): array;
public function getByTag(string $slug, int $page = 1): array;
public function getByAuthor(string $slug, int $page = 1): array;
public function search(string $query, int $page = 1): array;
} Repository methods return Post objects (or arrays of Post objects). They handle caching internally - you should never need to cache repository results manually.