PHPackages                             mateusjatenee/php-json-feed - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mateusjatenee/php-json-feed

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mateusjatenee/php-json-feed
===========================

PHP project.

1.0.6(8y ago)707368[1 issues](https://github.com/mateusjatenee/php-json-feed/issues)MITPHPPHP &gt;=7.0

Since May 22Pushed 8y ago5 watchersCompare

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

READMEChangelog (6)Dependencies (4)Versions (7)Used By (0)

PHP Json Feed
=============

[](#php-json-feed)

[![Build Status](https://camo.githubusercontent.com/cbb970894236174bf8d5ddd80172bb090fe6585099b1f2a60d1ee8064fbd4fec/68747470733a2f2f7472617669732d63692e6f72672f6d61746575736a6174656e65652f7068702d6a736f6e2d666565642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mateusjatenee/php-json-feed)[![Latest Stable Version](https://camo.githubusercontent.com/840ba19775e35a9ad334c4307bb764dd77728e4442fc0129fcb9674ddad25c10/68747470733a2f2f706f7365722e707567782e6f72672f6d61746575736a6174656e65652f7068702d6a736f6e2d666565642f762f737461626c65)](https://packagist.org/packages/mateusjatenee/php-json-feed)[![Total Downloads](https://camo.githubusercontent.com/6284895b43d7ca6d4b09e63867252e1e9dee917f1bf084bc4b5ff071e488b82d/68747470733a2f2f706f7365722e707567782e6f72672f6d61746575736a6174656e65652f7068702d6a736f6e2d666565642f646f776e6c6f616473)](https://packagist.org/packages/mateusjatenee/php-json-feed)[![Latest Unstable Version](https://camo.githubusercontent.com/5884f5434567796288b9cf77e5c8effb532f3becf309f0e48f851572b00f9ee1/68747470733a2f2f706f7365722e707567782e6f72672f6d61746575736a6174656e65652f7068702d6a736f6e2d666565642f762f756e737461626c65)](https://packagist.org/packages/mateusjatenee/php-json-feed)[![License](https://camo.githubusercontent.com/d4be7813c1e36c7661acdefee978ec8b2070ef3267d5d596f45f7284dcbd9eab/68747470733a2f2f706f7365722e707567782e6f72672f6d61746575736a6174656e65652f7068702d6a736f6e2d666565642f6c6963656e7365)](https://packagist.org/packages/mateusjatenee/php-json-feed)

[![bitmoji](https://camo.githubusercontent.com/bd2bc5fc8ebc78769343ee271bbf611ab326582b42a0f4027771528d08413b86/68747470733a2f2f72656e6465722e6269747374726970732e636f6d2f76322f6370616e656c2f31303135323634382d3238303838383332385f322d73342d76312e706e673f7472616e73706172656e743d312670616c657474653d312677696474683d323436)](https://camo.githubusercontent.com/bd2bc5fc8ebc78769343ee271bbf611ab326582b42a0f4027771528d08413b86/68747470733a2f2f72656e6465722e6269747374726970732e636f6d2f76322f6370616e656c2f31303135323634382d3238303838383332385f322d73342d76312e706e673f7472616e73706172656e743d312670616c657474653d312677696474683d323436)

This library provides a way to generate [JSON feeds](https://jsonfeed.org), a format recently introduced to the community.

#### Installation via Composer

[](#installation-via-composer)

```
$ composer require mateusjatenee/php-json-feed
```

#### Laravel Installation

[](#laravel-installation)

On your `config/app.php` file, register the service provider:

```
'providers' => [
    ...
    Mateusjatenee\JsonFeed\JsonFeedServiceProvider::class,
];
```

And on the `aliases` array, register the facade:

```
'aliases' => [
    ...
    'JsonFeed' => Mateusjatenee\JsonFeed\Facades\JsonFeed::class,
];
```

#### Usage

[](#usage)

The library is really simple to use and actually does not depend on Laravel itself, though it allows you to use a config file (not yet). It automatically filters formats the JSON and removes any unnecessary property.

If you're not using Laravel, [jump to this part](#all-at-once).

How to use it? Let's take the following JSON as an example:

```
{
    "title": "My JSON Feed test",
    "home_page_url": "https://mguimaraes.co",
    "feed_url": "https://mguimaraes.co/feeds/json",
    "author": {
        "url": "https://twitter.com/mateusjatenee",
        "name": "Mateus Guimarães"
    },
    "icon": "https://mguimaraes.co/assets/img/icons/apple-touch-icon-72x72.png",
    "favicon": "https://mguimaraes.co/assets/img/icons/favicon.ico",
    "version": "https://jsonfeed.org/version/1",
    "items": [
        {
            "content_text": "Great book. It's the best book.",
            "date_published": "2017-05-22T00:00:00+00:00",
            "title": "1984",
            "author": {
                "name": "Mateus",
                "url": "https://mguimaraes.co"
            },
            "content_html": "Great book. It's the best book.",
            "id": "abc123",
            "url": "https://mguimaraes.co",
            "external_url": "https://laravel.com",
            "date_modified": "2017-05-22T00:00:00+00:00"
        },
        {
            "content_text": "Great book. It's the best book.",
            "date_published": "2017-05-22T00:00:00+00:00",
            "title": "1984",
            "author": {
                "name": "Mateus",
                "url": "https://mguimaraes.co"
            },
            "content_html": "Great book. It's the best book.",
            "id": "abc123",
            "url": "https://mguimaraes.co",
            "external_url": "https://laravel.com",
            "date_modified": "2017-05-22T00:00:00+00:00"
        }
    ]
}
```

To do this, first you need to set the config — you can set it at any time during runtime (on a Service Provider, perhaps) using the Facade or instantiating it through the container (i.e `app('jsonFeed')`)

```
