Laravel-SEO

SEO package made for maximum customization and flexibility

MIT License

Downloads
113.1K
Stars
336
Committers
4

Bot releases are hidden (Show)

Laravel-SEO - v2.6.0 Latest Release

Published by romanzipp 12 months ago

Changes


EmbedX is a new project I founded with some friends which allows you to generate rich preview thumbnails for X/Twitter.

Laravel-SEO - v2.2.0

Published by romanzipp almost 4 years ago

Added sections feature. See docs for more information

Laravel-SEO - v2.1.0

Published by romanzipp about 4 years ago

Added addFromArray method to allow settings SEO values from nested array. See docs for more information

Laravel-SEO - v2.0.0

Published by romanzipp over 4 years ago

Upgrading from 1.0 to 2.0

SeoService

The clear Method

The clear method has been renamed to a more consistent clearStructs method.

- seo()->clear();
+ seo()->clearStructs();

The render Method

The render method now returns a RenderConductor which implements the Renderable, Htmlable and Arrayable interfaces instead of a HtmlString.

/** @var $content string */
- $content = (string) seo()->render();
+ $content = seo()->render()->toHtml();

You can still use {{ seo()->render() }} in Blade templates.

/** @var $content array */
- $content = seo()->renderContentsArray();
+ $content = seo()->render()->toArray();
/** @var $content Illuminate\Support\HtmlString */
- $content = seo()->render();
+ $content = seo()->render()->build();

Structs

The defaults Method

The romanzipp\Seo\Structs\Struct::defaults() method now has a return type of void.

class CustomStruct extends Struct
{
-   public static function defaults(Struct $struct)
+   public static function defaults(Struct $struct): void
    {
        $struct->addAttribute('name', 'custom');
    }
}

Fluent Setters

All fluent setter methods now share the same return type of romanzipp\Seo\Structs\Struct.

use romanzipp\Seo\Structs\Struct;

class CustomStruct extends Meta
{
-   public function property($value = null, bool $escape = true): self
+   public function property($value = null, bool $escape = true): Struct
    {
        $this->addAttribute('property', 'custom:' . $value, $escape);

        return $this;
    }
}

Laravel-Mix

The filter and reject Methods

Both filter and reject methods in the Laravel-Mix integration have been replaced with a more general map method.

seo()
    ->mix()
-   ->filter(function ($path, $url) {
-       // ...
-   })
-   ->reject(function ($path, $url) {
-       // ...
-   });
+   ->map(static function (ManifestAsset $asset): ?ManifestAsset {
+       // ...
+   });

The rel Method

The rel setter for the Laravel-Mix integration has been removed.

seo()
    ->mix()
-   ->rel('preload');
+   ->map(static function (ManifestAsset $asset): ?ManifestAsset {
+       $asset->rel = 'preload';
+       return $asset;
+   });

The getAssets Method

The MixManifestConductor::getAssets() method now returns an array of type ManifestAsset[].

Laravel-SEO - v1.2.0

Published by romanzipp over 4 years ago

Laravel 7 support

Laravel-SEO - v1.0.3

Published by romanzipp over 5 years ago

Laravel-SEO - v1.0.2

Published by romanzipp over 5 years ago

  • Add bool $escape = true parameter to all struct setter methods
Laravel-SEO - v1.0.1

Published by romanzipp over 5 years ago

  • Add seo()->meta() shorthand method
  • Simplify Readme Examples
  • Enhance various docs
Laravel-SEO - v1.0.0

Published by romanzipp over 5 years ago

  • Initial stable release
  • Add Laravel 5.8 Support
  • Add consistent attribute values & body escaping