postsimple/filament-postsimple 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

postsimple/filament-postsimple

Composer 安装命令:

composer require postsimple/filament-postsimple

包简介

Send your Filament resources to PostSimple for AI-powered social media content generation

README 文档

README

Latest Version on Packagist Total Downloads

Send content from your Filament admin panel to PostSimple with one click to automatically generate professional social media content powered by AI.

About PostSimple

PostSimple is an AI-powered social media tool that automatically creates and schedules social media posts tailored to your brand's style across all channels. This Filament plugin allows you to seamlessly send content from your Filament resources to PostSimple for instant social media content generation.

Features

  • One-click integration - Send any resource to PostSimple with a single click
  • Easy configuration - Simple API key setup via .env file
  • Automatic detection - Intelligently finds title and URL from your models
  • Works everywhere - Add to any Filament resource (Posts, Pages, Products, etc.)
  • Multi-language support - Includes English and Dutch translations
  • Secure - API key stored in environment variables

Requirements

  • PHP 8.1 or higher
  • Laravel 10.0 or higher
  • Filament 4.x or 5.x
  • PostSimple Pro subscription with API access

Note: The PostSimple API is only available with a Pro subscription. Request your API key at api@postsimple.nl

Installation

Install the package via Composer:

composer require postsimple/filament-postsimple

Publish the config file (optional):

php artisan vendor:publish --tag="filament-postsimple-config"

Configuration

1. Register the Plugin

Add the plugin to your Filament panel provider (e.g., app/Providers/Filament/AdminPanelProvider.php):

use PostSimple\FilamentPostSimple\FilamentPostSimplePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            FilamentPostSimplePlugin::make(),
        ]);
}

2. Get Your API Key

  1. Ensure you have a PostSimple Pro subscription
  2. Send an email to api@postsimple.nl with:
    • Your company name
    • Your PostSimple account email
    • Your website URL
  3. You'll receive your API key within 1-2 business days

3. Configure the API Key

Add your PostSimple API key to your .env file:

POSTSIMPLE_API_KEY=ps_your_api_key_here

Usage

Adding the Action to Resources

Recommended: Add the action to your EditRecord or ViewRecord pages. This ensures the record context is properly available.

Add to your resource's EditRecord or ViewRecord page:

use PostSimple\FilamentPostSimple\Actions\SendToPostSimpleAction;

protected function getHeaderActions(): array
{
    return [
        SendToPostSimpleAction::make(),
        // ... other actions
    ];
}

Alternative: Table Row Action

If you prefer to add the action directly in your resource table, you can use SendToPostSimpleTableAction:

use PostSimple\FilamentPostSimple\Actions\SendToPostSimpleTableAction;

public static function table(Table $table): Table
{
    return $table
        ->columns([
            // ... your columns
        ])
        ->actions([
            SendToPostSimpleTableAction::make(),
            // ... other actions
        ]);
}

Example: Blog Post Resource

Here's a complete example of adding PostSimple to a blog post resource. Add the action to your EditPost page:

<?php

namespace App\Filament\Resources\PostResource\Pages;

use App\Filament\Resources\PostResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use PostSimple\FilamentPostSimple\Actions\SendToPostSimpleAction;

class EditPost extends EditRecord
{
    protected static string $resource = PostResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\DeleteAction::make(),
            SendToPostSimpleAction::make(), // Add this line
        ];
    }
}

How It Works

  1. Click the "Send to PostSimple" button on any record
  2. Confirm the action in the modal
  3. The plugin sends the title and URL to PostSimple
  4. You're automatically redirected to PostSimple to view the generated content

Model Requirements

The plugin works best when your models follow certain conventions, but it's flexible enough to work with any structure.

Automatic Title Detection

The plugin automatically looks for these fields (in order):

  1. Custom field (if you specify with ->titleAttribute())
  2. title
  3. name
  4. heading
  5. subject
  6. Falls back to ModelName #ID

Example:

// Works automatically - has 'title' field
class Post extends Model {
    protected $fillable = ['title', 'content'];
}

// Works automatically - has 'name' field  
class Product extends Model {
    protected $fillable = ['name', 'price'];
}

// Needs customization - has different field
class Article extends Model {
    protected $fillable = ['headline', 'body'];
}
// Use: ->titleAttribute('headline')

Automatic URL Detection

The plugin tries to get the URL in this order:

  1. Custom closure (if you specify with ->urlUsing())
  2. $record->getUrl() method
  3. $record->url() method
  4. Builds from slug field: /table-name/{slug}
  5. Falls back to: /table-name/{id}

Example with getUrl() method:

class Post extends Model
{
    protected $fillable = ['title', 'slug', 'content'];

    // Add this method to your model
    public function getUrl(): string
    {
        return url('/blog/' . $this->slug);
    }
}

Example with route helper:

class Product extends Model
{
    public function getUrl(): string
    {
        return route('products.show', $this);
    }
}

When Customization is Required

You need to customize when:

  • Your title field has a non-standard name (not title, name, heading, or subject)
  • You need a specific URL format that can't be auto-detected
  • You're working with a headless frontend (different domain)

Product example with customization:

SendToPostSimpleTableAction::make()
    ->titleAttribute('product_name')
    ->urlUsing(fn ($record) => 'https://shop.example.com/products/' . $record->sku)

Customization

Custom Title Field

If your model uses a different field for the title, you can specify it:

SendToPostSimpleAction::make()
    ->titleAttribute('product_name') // Use 'product_name' instead of 'title'

Custom URL

You can provide a custom closure to generate the URL:

SendToPostSimpleTableAction::make()
    ->urlUsing(fn ($record) => route('shop.product', $record))

Complete Customization Example

use PostSimple\FilamentPostSimple\Actions\SendToPostSimpleTableAction;

public static function table(Table $table): Table
{
    return $table
        ->columns([
            Tables\Columns\TextColumn::make('product_name'),
            Tables\Columns\TextColumn::make('sku'),
        ])
        ->actions([
            SendToPostSimpleTableAction::make()
                ->titleAttribute('product_name') // Custom title field
                ->urlUsing(fn ($record) => route('shop.product', $record->slug)), // Custom URL
        ]);
}

Using Both Title and URL Customization

SendToPostSimpleAction::make()
    ->titleAttribute('custom_heading')
    ->urlUsing(function ($record) {
        return config('app.frontend_url') . '/posts/' . $record->id;
    })

Configuration Options

The plugin publishes a config file with the following options:

return [
    // Your PostSimple API key (required)
    'api_key' => env('POSTSIMPLE_API_KEY'),

    // API endpoint (don't change unless instructed)
    'api_endpoint' => env('POSTSIMPLE_API_ENDPOINT', 'https://postsimple.link/api/plugins/create-post'),

    // PostSimple app URL
    'app_url' => env('POSTSIMPLE_APP_URL', 'https://my.postsimple.app/lab'),

    // Request timeout (seconds)
    'timeout' => env('POSTSIMPLE_TIMEOUT', 30),
];

Add to your .env file:

POSTSIMPLE_API_KEY=ps_your_api_key_here

Translations

The plugin includes translations for English and Dutch. The language is automatically detected from your Laravel application's locale.

To publish and customize the translations:

php artisan vendor:publish --tag="filament-postsimple-lang"

This will publish the language files to lang/vendor/filament-postsimple/.

Troubleshooting

"PostSimple API key not configured"

  • Add POSTSIMPLE_API_KEY=your_key to your .env file
  • Run php artisan config:clear if using config caching

"No title found"

  • Ensure your model has a title, name, heading, or subject field
  • Or add a custom getter method

"No URL found"

  • Add a getUrl() or url() method to your model
  • Or ensure your model has a slug field

"Failed to send to PostSimple"

  • Check that your API key is correct
  • Verify you have an active Pro subscription
  • Check your internet connection
  • View the error message for more details

Support

For questions or issues:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Security

If you discover any security-related issues, please email contact@postsimple.nl instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

postsimple/filament-postsimple 适用场景与选型建议

postsimple/filament-postsimple 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「ai」 「social-media」 「filament」 「filament-plugin」 「postsimple」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 postsimple/filament-postsimple 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 postsimple/filament-postsimple 我们能提供哪些服务?
定制开发 / 二次开发

基于 postsimple/filament-postsimple 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-29