PHPackages                             moxie-lean/wp-endpoints-collection - 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. moxie-lean/wp-endpoints-collection

AbandonedLibrary[API Development](/categories/api)

moxie-lean/wp-endpoints-collection
==================================

Query against a WordPress site and get a JSON response with a collection of data associated with your request.

1.2.0(10y ago)01.2k1MITPHPPHP &gt;=5.4

Since Mar 31Pushed 10y ago6 watchersCompare

[ Source](https://github.com/wearenolte/wp-endpoints-collection)[ Packagist](https://packagist.org/packages/moxie-lean/wp-endpoints-collection)[ Docs](https://github.com/moxie-lean/wp-endpoints-collection)[ RSS](/packages/moxie-lean-wp-endpoints-collection/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (4)Versions (15)Used By (0)

WP Endpoint Collection
======================

[](#wp-endpoint-collection)

**This package is depreciated. LEAN now uses the WordPress REST API plugins instead**

> Query against a WordPress site and get a JSON response with a collection of data associated with your request.

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

[](#getting-started)

The easiest way to install this package is by using composer from your terminal:

```
composer require moxie-lean/wp-endpoints-collection
```

Or by adding the following lines on your `composer.json` file

```
"require": {
  "moxie-lean/wp-endpoints-collection": "dev-master"
}
```

This will download the files from the [packagist site](https://packagist.org/packages/moxie-lean/wp-endpoints-collection)and set you up with the latest version located on master branch of the repository.

After that you can include the `autoload.php` file in order to be able to autoload the class during the object creation.

```
include '/vendor/autoload.php';

\Lean\Endpoints\Collection::init();
```

Features
--------

[](#features)

- Avoid to query post that are on draft, private or any other state that is not publish.
- Avoid to query post with passwords protections.

By default returns only a collection of posts but any post type can be specifed to be returned or a collection of multiple post types can be specifed as well.

Usage.
------

[](#usage)

The default URL is:

```
/wp-json/leean/v1/collection
```

By default the collection is the list of posts, you can use most
of the WP_Query params in order to update your results, for example by
default uses setting that specifies the number of reading post on the
settings page.

## Request examples

Get only the latest 3 posts.

```json
wp-json/leean/v1/collection?posts_per_page=3
```

How about get the latest 3 posts that belongs to the author with the ID
1.

```json
wp-json/leean/v1/collection?posts_per_page=3&author=1
```

Or just get the posts that belong to the author with the ID 1.

```json
wp-json/leean/v1/collection?author=1
```

Get the all the posts ordered by ID from lowest to highest values.

```json
wp-json/leean/v1/collection?orderby=ID&order=ASC
```

Get all the posts and pages published on the site.

```json
wp-json/leean/v1/collection?post_type[]=post&post_type[]=page
```

Get the first and second page of the blog section.

```json
wp-json/leean/v1/collection
wp-json/leean/v1/collection?paged=2
```

Get all the posts that has the category ID 2

```json
wp-json/leean/v1/collection?cat=2
```

## Filters

There are filters that can be used on this particular endpoint.

`ln_endpoints_collection_args`. This filter allow you to overwrite the
default arguments used to query inside of the collection so you can
overwrite the default values used on the `WP_Query` before executed.

`ln_endpoints_collection_data`. This filter allow you to overwrite the
data after processing and before is sending it to the client it has 1
parameter that can be used on the filter:

 - `$data` The original data created by the endpoint, this is an array
   with all the data, for example if you want to return an empty array
if the data has zero items.

 - `$request` An array with the arguments used to create the request.

```php
add_filter('ln_endpoints_collection_data', function( $data ){
  if ( isset( $data['pagination']['items'] ) && $data['pagination']['items'] === 0 ) {
    return [];
  } else {
    return $data;
  }
});
```

`ln_endpoints_collection_item`. Allows you to easily customise the output of each post:

```php
add_filter( 'ln_endpoints_collection_item', function($item, $the_post) {
      if ( $the_post->ID === 1 ) {
        return [
         'message' => 'Nothing here',
        ];
      } else {
        return $item;
      }
    }, 10, 2);;
```

```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~6 days

Recently: every ~12 days

Total

13

Last Release

3669d ago

Major Versions

0.4.1 → 1.0.02016-04-25

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3921289?v=4)[Crisoforo Gaspar Hernández](/maintainers/mitogh)[@mitogh](https://github.com/mitogh)

![](https://www.gravatar.com/avatar/4aa05a59deaf5695b3a80e42e2c6b971ab92c171ad13cd7b95ca8175382cda60?d=identicon)[WeAreNolte](/maintainers/WeAreNolte)

---

Top Contributors

[![mitogh](https://avatars.githubusercontent.com/u/3921289?v=4)](https://github.com/mitogh "mitogh (54 commits)")[![zzuga](https://avatars.githubusercontent.com/u/13990408?v=4)](https://github.com/zzuga "zzuga (8 commits)")[![camilodelvasto](https://avatars.githubusercontent.com/u/4598282?v=4)](https://github.com/camilodelvasto "camilodelvasto (1 commits)")

---

Tags

wordpressWordPress-API

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/moxie-lean-wp-endpoints-collection/health.svg)

```
[![Health](https://phpackages.com/badges/moxie-lean-wp-endpoints-collection/health.svg)](https://phpackages.com/packages/moxie-lean-wp-endpoints-collection)
```

###  Alternatives

[sybrew/the-seo-framework

An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.

47882.8k](/packages/sybrew-the-seo-framework)

PHPackages © 2026

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