Skip to content

yubarajshrestha/iarticles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iArticles

GitHub stars Latest Stable Version Total Downloads License

If you are seeking package for generating instant article or feeds then yes, this package is for you.

This helps you generate facebooks instant articles and also regular feeds with enough customizations you might need.

How to?

Step 1: Install package

Install package by executing the command.

composer require yubarajshrestha/iarticles

Step 2: Publish Vendor Files

You need to have some files and don't worry it's quite easy. You just want to execute the command now.

php artisan vendor:publish --tag=iarticles

Step 3: Update Configurations

You need to define options in your iarticles configuration file. You'll find default options from where you will get an idea on how to configure things.

Step 4: Implement Instant Article Interface to your Model and configure as follows

use YubarajShrestha\IArticles\InstantArticle;
use YubarajShrestha\IArticles\Articles;
class YourModel implements InstantArticle {


    /** 
     * Instant Article
     * @return Collection of YourModel
     */
    public static function getFeedItems()
    {
        return YourModel::latest()->get()->take(25);
    }

    /** 
     * Filter Feed Data
     * @return iArticle Object
     */
    public function iArticle()
    {
        return Articles::create([
            'id' => $this->id, // required | integer
            'title' => $this->name, // required | string
            'subtitle' => '', // nullable | string
            'kicker' => $this->kicker, // nullable | string
            'summary' => '', // required | string
            'description' => '', // required | string
            'cover' => '', // nullable | string
            'updated' => '', // required | date
            'published' => Carbon::parse($this->created_at), // required | date
            'link' => '', // full url to item...
            'author' => '' // nullable | email | string
        ]);
    }
}

Step 5: Awesome

  1. Your project is now ready to go 👍.

About

Instant Article and/or Feed Generator for your website.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published