areia-lab/laravel-seo-solution
Composer 安装命令:
composer require areia-lab/laravel-seo-solution
包简介
SEO management package with Tailwind UI backend, OpenGraph & Twitter, and Blade helpers.
关键字:
README 文档
README
A modern Laravel SEO management package with:
- 📊 Tailwind UI backend for managing SEO meta data
- 🌐 OpenGraph & Twitter Card support out of the box
- ⚡ Blade helpers for easy rendering in views
📖 Documentation: Complete Guide to Laravel SEO Solution
🚀 Requirements
- PHP 8.0+
- Laravel 9.x / 10.x / 11.x / 12.x
- Database supported by Laravel (MySQL, PostgreSQL, SQLite, etc.)
- Node & NPM (if you want to customize/publish Tailwind UI)
📦 Installation
- Require the package:
composer require areia-lab/laravel-seo-solution
- Publish config & migrate:
php artisan vendor:publish --tag=seo-config php artisan vendor:publish --tag=seo-migrations php artisan migrate
- Publish views:
php artisan vendor:publish --tag=seo-views
⚙️ Configuration
The config file config/seo.php contains:
return [ 'route' => [ 'prefix' => env('SEO_PANEL_PREFIX', 'admin/seo'), 'middleware' => ['web'], ], 'disk' => env('SEO_DISK', 'public'), 'defaults' => [ 'title_suffix' => '', ], 'cache' => false, 'panel' => [ 'title_prefix' => 'Areia Lab SEO' ], ];
- Change
prefixormiddlewareas needed. - Run
php artisan storage:linkso uploaded OG/Twitter images are accessible.
🖥️ Admin Panel
Manage SEO meta records via:
/admin/seo
Features:
- Types:
global,page,model - Meta:
title,description,keywords,author,robots,canonical - OpenGraph:
title,description,type,image - Twitter:
title,description,card,image
📝 Usage in Blade
Place directives inside your layout <head> section.
Remove <title> (tag) or <title>{{ config('app.name', 'Laravel') }}</title> (this line) from your layout<head> section.
1. Global
@seoGlobal
or:
{!! app('seo')->global()->render() !!}
2. Page-specific
@seoAutoPage @seoPage('contact') // Using Route Name. e.g. "->name('contact')" # or @seoPage('contact-us') // Using URL Slug. e.g. "/contact-us"
or:
{!! app('seo')->forPage('contact')->render() !!} # or {!! app('seo')->forPage('contact-us')->render() !!}
3. Model-based (e.g. Blog Post)
@php $post = Post::first(); @endphp @seoModel($post)
or:
@php $post = Post::first(); @endphp {!! app('seo')->forModel($post)->render() !!}
✅ All Together in Layout
<head> @seoGlobal @seoAutoPage // This blade derivative is recommaded # or @isset($pageKey) @seoPage($pageKey) // Pass Data from blade. If Data changed from pannel it may not work. you need to fix statically @endisset # or @seoPage(Route::currentRouteName()) // it may not work if Route name means "->name('something')" not define or not match # or @seoPage(request()->path()) // it may not work if Route Uri "Route::get('something')" not match @isset($post) @seoModel($post) @endisset </head>
🔗 Examples
✅ Layout Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>@yield('title', 'My Website')</title> {{-- Inject SEO --}} @seoGlobal @seoAutoPage @isset($pageKey) @seoPage($pageKey) @endisset @isset($seoModel) @seoModel($seoModel) @endisset </head> <body> @yield('content') </body> </html>
✅ Page Example 1
['pageKey' => request()->path() ?? (Route::currentRouteName() ?? '/')] # or @extends('layouts.app') @section('title', 'Contact Us') @section('content') <h2>Contact Us</h2> <p>Feel free to reach out!</p> @endsection @push('head') @seoPage('contact') @endpush
✅ Page Example 2
Inside Layout
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>@yield('title', 'My Website')</title> <!-- Render SEO meta from pushed content --> @stack('head') </head> <body> @yield('content') </body> </html>
@extends('layouts.app') @section('title', 'Contact Us') @section('content') <h2>Contact Us</h2> <p>Feel free to reach out!</p> @endsection @push('head') @seoPage('contact') @endpush # or @push('head') @seoPage('/contact-us') @endpush
✅ Model Example
- First enable from config
'menu' => [ 'model' => true, // Hide model management by default ]
# inside your all seo able model you need to add 'HasSeoMeta' Trait # It require for getting only seo free model instance # In your 'Blog, Service, Product, Post' model jus add use AreiaLab\LaravelSeoSolution\Traits\HasSeoMeta; use HasSeoMeta;
@extends('layouts.app') @section('title', $post->title) @section('content') <h2>{{ $post->title }}</h2> <p>{{ $post->body }}</p> @endsection @push('head') @seoModel($post) @endpush
✅ For Production or Host inside (Cpanel, AWS or Other)
php artisan vendor:publish --tag=seo-views
npm install npm run build
Go To <views\areia\seo\layouts\app.blade.php>
# remove this line from `<head>` @vite(['resources/css/app.css', 'resources/js/app.js']) # Add <!-- Styles / Scripts --> <link rel="stylesheet" href="{{ asset('build/assets/{Your Generated CSS File Name}.css') }}"> <script src="{{ asset('build/assets/{Your Generated JS File Name}.js') }}" defer></script>
🌱 Seeder
Seed default SEO meta:
php artisan db:seed --class="AreiaLab\LaravelSeoSolution\Database\Seeders\SeoMetaSeeder"
📖 License
MIT License – Use freely in personal & commercial projects.
areia-lab/laravel-seo-solution 适用场景与选型建议
areia-lab/laravel-seo-solution 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「seo」 「opengraph」 「meta-tags」 「seo-manager」 「laravel-seo-solution」 「seo-solution」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 areia-lab/laravel-seo-solution 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 areia-lab/laravel-seo-solution 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 areia-lab/laravel-seo-solution 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Meta Manager is an SEO tool that is used to improve SEO of a website or specific page by adding recommended meta tags to your application.
Simple PHP Open Graph Protocol parser library
Phalcon PHP Meta tags service
HTML meta tags generator for Kirby 3.
Environment, SEO, and build utilities for Kirby CMS
Improves silverstripes html meta data options.
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-03
