kinjari / laravel-zenblog
A Laravel package for using Zenblog in your projects.
Fund package maintenance!
kinjari
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 1
pkg:composer/kinjari/laravel-zenblog
Requires
- php: ^8.4
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- spatie/laravel-ray: ^1.35
This package is auto-updated.
Last update: 2026-01-22 19:24:38 UTC
README
A Laravel package that provides a simple and elegant interface to interact with the Zenblog API. Fetch posts, categories, tags, and authors with ease using Laravel's familiar syntax.
Support us
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
Installation
You can install the package via composer:
composer require kinjari/laravel-zenblog
You can publish and run the migrations with:
php artisan vendor:publish --tag="laravel-zenblog-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="laravel-zenblog-config"
This is the contents of the published config file:
return [ 'api_url' => env('ZENBLOG_API_URL', 'https://demo.zenblog.org/api'), 'blog_id' => env('ZENBLOG_BLOG_ID', null), ];
Configuration
Add these environment variables to your .env file:
# Required: Your Zenblog API URL ZENBLOG_API_URL=https://your-blog.zenblog.com/api # Optional: Your Blog ID for authentication (if required by your Zenblog instance) ZENBLOG_BLOG_ID=your-blog-id-from-dashboard
The blog_id is required for most Zenblog installations and will be included in the API URL path as /blogs/{blog_id}/.... You can find your blog ID in the Zenblog dashboard.
Optionally, you can publish the views using
php artisan vendor:publish --tag="laravel-zenblog-views"
Usage
The package provides four models to interact with the Zenblog API: Post, Category, Tag, and Author. Each model supports the same methods for fetching data.
Posts
use Kinjari\LaravelZenblog\Models\Post; // Get all posts $posts = Post::all(); // Find a specific post by slug $post = Post::find('my-blog-post'); // Get paginated posts $paginatedPosts = Post::paginate(10, 1); // 10 per page, page 1
Categories
use Kinjari\LaravelZenblog\Models\Category; // Get all categories $categories = Category::all(); // Get paginated categories $paginatedCategories = Category::paginate(10, 1);
Tags
use Kinjari\LaravelZenblog\Models\Tag; // Get all tags $tags = Tag::all(); // Get paginated tags $paginatedTags = Tag::paginate(10, 1);
Authors
use Kinjari\LaravelZenblog\Models\Author; // Get all authors $authors = Author::all(); // Find a specific author by slug $author = Author::find('john-doe'); // Get paginated authors $paginatedAuthors = Author::paginate(10, 1);
Working with Results
All models return collections or individual model instances with accessible attributes:
$post = Post::find('my-blog-post'); echo $post->title; echo $post->content; echo $post->slug; $posts = Post::all(); foreach ($posts as $post) { echo $post->title; }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.