articlai / articlai-laravel
Package to allow blog publishing in Laravel using Articlai
Fund package maintenance!
Articlai
Requires
- php: ^8.3
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- 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
This package is auto-updated.
Last update: 2025-07-21 21:08:17 UTC
README
A Laravel package that enables seamless integration with ArticlAI's Custom API connection type. This package provides secure API endpoints that allow ArticlAI to create, update, and delete blog posts in your Laravel application.
Installation
You can install the package via composer:
composer require articlai/articlai-laravel
You can publish and run the migrations with:
php artisan vendor:publish --tag="articlai-laravel-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="articlai-laravel-config"
Configuration
After publishing the config file, update your .env
file with your ArticlAI settings:
# Authentication Method (api_key, bearer_token, or basic_auth) ARTICLAI_AUTH_METHOD=api_key ARTICLAI_API_KEY=your-secret-api-key
API Endpoints
The package provides the following endpoints for ArticlAI integration:
Validation Endpoint
GET /api/articlai/validate
Returns platform information and validates the connection.
Content Management
POST /api/articlai/posts # Create a new post
GET /api/articlai/posts/{id} # Get a specific post
PUT /api/articlai/posts/{id} # Update a post
DELETE /api/articlai/posts/{id} # Delete a post
Usage
Using the Service Class
use Articlai\Articlai\Articlai; $articlai = app(Articlai::class); // Create a post $post = $articlai->createPost([ 'title' => 'My Blog Post', 'content' => '<p>This is the content</p>', 'excerpt' => 'Post excerpt', 'status' => 'published' ]); // Update a post $updatedPost = $articlai->updatePost($post->id, [ 'title' => 'Updated Title' ]); // Get posts $posts = $articlai->getPosts(['status' => 'published']);
Using the Facade
use Articlai\Articlai\Facades\Articlai; $post = Articlai::createPost([ 'title' => 'My Blog Post', 'content' => '<p>This is the content</p>' ]);
Using the Model Directly
use Articlai\Articlai\Models\ArticlaiPost; $post = ArticlaiPost::create([ 'title' => 'My Blog Post', 'content' => '<p>This is the content</p>', 'status' => 'published' ]); // Get published posts $publishedPosts = ArticlaiPost::published()->get();
Command Line Interface
Check the package status and view recent posts:
php artisan articlai:status --posts=10
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.