PHP, Laravel & WordPress

Use negusdev/seoinjector-php from any PHP app. Ships with a Laravel service provider and WordPress hooks.

View on GitHub →

Install

composer require negusdev/seoinjector-php

Vanilla PHP

<?php
use SEOInjector\SEOInjector;

$seo = new SEOInjector('Site_id_here', [
        'api_url' => 'https://api.seoinjector.com/api/v1',
        'cache' => false,
]);

?>
<!doctype html>
<html>
<head>
  <?= $seo->render() ?>
</head>
<body>…</body>
</html>

Laravel

The service provider auto-registers. Publish the config:

php artisan vendor:publish --tag=seoinjector-config

Add your project ID to .env:

SEO_INJECTOR_PROJECT_ID=proj_xxxxxxxxxxxx

Use the Blade directive in your layout:

<!-- resources/views/layouts/app.blade.php -->
<head>
  @seoinjector
</head>

Or via the facade for per-route fallbacks:

use NegusDev\SeoInjector\Facades\SEO;

Route::get('/about', function () {
  SEO::fallback(['title' => 'About — Acme']);
  return view('about');
});

WordPress

Drop the plugin file in wp-content/plugins/seoinjector/ and activate it. Configure under Settings → SEO Injector, or via constants:

// wp-config.php
define('SEO_INJECTOR_PROJECT_ID', 'proj_xxxxxxxxxxxx');

The plugin hooks into wp_head automatically and removes duplicate tags emitted by themes / other SEO plugins.

Caching

Responses are cached in APCu or the configured Laravel cache for 60 s. Dashboard edits broadcast a purge through your project's webhook URL — show this in the dashboard under Project → Integrations.

Troubleshooting

  • Duplicate <title> tags? Remove the hard-coded one from your layout; SEO Injector always emits one.
  • Composer install fails? Requires PHP 8.1+ and the curl + json extensions.
  • Cache stuck? Run php artisan seoinjector:purge (Laravel) or click Purge cache in the dashboard.