From 360b08af536daeb5ee2107b0954c60a0a3658c96 Mon Sep 17 00:00:00 2001
From: Tjardo <31533540+tjardoo@users.noreply.github.com>
Date: Fri, 17 Feb 2023 18:52:50 +0100
Subject: [PATCH] Add Laravel 10.x support (#30)
* Add Laravel 10.x support
* Remove windows
* Lock Carbon
---------
Co-authored-by: Ralph J. Smit <59207045+ralphjsmit@users.noreply.github.com>
---
.github/workflows/run-tests.yml | 10 ++--
README.md | 24 ++++-----
composer.json | 89 +++++++++++++++++----------------
3 files changed, 59 insertions(+), 64 deletions(-)
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index 2c6d2b3..a61e87a 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -12,15 +12,15 @@ jobs:
strategy:
fail-fast: true
matrix:
- os: [ ubuntu-latest, windows-latest ]
- php: [ 8.0 ]
- laravel: [ 8.*, 9.* ]
+ os: [ ubuntu-latest ]
+ php: [ 8.1, 8.2 ]
+ laravel: [ 9.*, 10.* ]
stability: [ prefer-lowest, prefer-stable ]
include:
- - laravel: 8.*
- testbench: ^6.23
- laravel: 9.*
testbench: ^7.0
+ - laravel: 10.*
+ testbench: ^8.0
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
diff --git a/README.md b/README.md
index 3e94a3f..981c520 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ It will render the SEO tags directly on your page:
{!! seo()->for($post) !!}
-
+
{{-- No need to separately render a tag or any other meta tags! --}}
```
@@ -45,11 +45,11 @@ It even allows you to **dynamically retrieve SEO data from your model**, without
class Post extends Model
{
use HasSEO;
-
+
public function getDynamicSEOData(): SEOData
{
$pathToFeaturedImageRelativeToPublicPath = // ..;
-
+
// Override only the properties you want:
return new SEOData(
title: $this->title,
@@ -70,7 +70,7 @@ composer require ralphjsmit/laravel-seo
Publish the migration and configuration file:
-```
+```sh
php artisan vendor:publish --tag="seo-migrations"
php artisan vendor:publish --tag="seo-config"
```
@@ -211,7 +211,7 @@ use RalphJSmit\Laravel\SEO\Support\HasSEO;
class Post extends Model
{
use HasSEO;
-
+
// ...
```
@@ -381,7 +381,7 @@ SchemaCollection::initialize()->addBreadcrumbs(
});
}
);
-```
+```
This code will generate `BreadcrumbList` JSON-LD structured data with the following four pages:
@@ -403,7 +403,7 @@ use RalphJSmit\Laravel\SEO\Facades\SEOManager;
SEOManager::SEODataTransformer(function (SEOData $SEOData): SEOData {
// This will change the title on *EVERY* page. Do any logic you want here, e.g. based on the current request.
$SEOData->title = 'Transformed Title';
-
+
return $SEOData;
});
```
@@ -417,10 +417,10 @@ You can also **register closures that can modify the final collection of generat
```php
SEOManager::tagTransformer(function (TagCollection $tags): TagCollection {
$tags = $tags->reject(fn(Tag $tag) => $tag instanceof OpenGraphTag);
-
+
$tags->push(new MetaTag(name: 'custom-tag', content: 'My custom content'));
// Will render:
-
+
return $tags;
});
```
@@ -440,9 +440,3 @@ PRs are welcome, so feel free to fork and submit a pull request. I'll be happy t
🙌 If you want to contribute, please submit a pull request. All PRs will be fully credited. If you're unsure whether I'd accept your idea, feel free to contact me!
🙋♂️ [Ralph J. Smit](https://ralphjsmit.com)
-
-
-
-
-
-
diff --git a/composer.json b/composer.json
index 435d162..a7837f5 100644
--- a/composer.json
+++ b/composer.json
@@ -1,69 +1,70 @@
{
- "name": "ralphjsmit/laravel-seo",
- "description": "A package to handle the SEO in any Laravel application, big or small.",
- "keywords": [
+ "name" : "ralphjsmit/laravel-seo",
+ "description" : "A package to handle the SEO in any Laravel application, big or small.",
+ "keywords" : [
"ralphjsmit",
"laravel",
"laravel-seo"
],
- "homepage": "https://github.com/ralphjsmit/laravel-seo",
- "license": "MIT",
- "authors": [
+ "homepage" : "https://github.com/ralphjsmit/laravel-seo",
+ "license" : "MIT",
+ "authors" : [
{
- "name": "Ralph J. Smit",
- "email": "rjs@ralphjsmit.com",
- "role": "Developer"
+ "name" : "Ralph J. Smit",
+ "email" : "rjs@ralphjsmit.com",
+ "role" : "Developer"
}
],
- "require": {
- "php": "^8.0",
- "illuminate/contracts": "^8.79|^9.0",
- "ralphjsmit/laravel-helpers": "^1.5",
- "spatie/laravel-package-tools": "^1.9.2"
+ "require" : {
+ "php" : "^8.0",
+ "illuminate/contracts" : "^9.0|^10.0",
+ "ralphjsmit/laravel-helpers" : "^1.5",
+ "spatie/laravel-package-tools" : "^1.9.2"
},
- "require-dev": {
- "nunomaduro/collision": "^5.10|^6.0",
- "orchestra/testbench": "^6.22|^7.0",
- "pestphp/pest": "^1.21",
- "pestphp/pest-plugin-laravel": "^1.1",
- "phpunit/phpunit": "^9.5",
- "spatie/laravel-ray": "^1.26",
- "spatie/pest-plugin-test-time": "^1.0"
+ "require-dev" : {
+ "nesbot/carbon" : "^2.66",
+ "nunomaduro/collision" : "^5.10|^6.0",
+ "orchestra/testbench" : "^7.0|^8.0",
+ "pestphp/pest" : "^1.21",
+ "pestphp/pest-plugin-laravel" : "^1.1",
+ "phpunit/phpunit" : "^9.5",
+ "spatie/laravel-ray" : "^1.26",
+ "spatie/pest-plugin-test-time" : "^1.0"
},
- "autoload": {
- "psr-4": {
- "RalphJSmit\\Laravel\\SEO\\": "src",
- "RalphJSmit\\Laravel\\SEO\\Database\\Factories\\": "database/factories"
+ "autoload" : {
+ "psr-4" : {
+ "RalphJSmit\\Laravel\\SEO\\" : "src",
+ "RalphJSmit\\Laravel\\SEO\\Database\\Factories\\" : "database/factories"
},
- "files": [
+ "files" : [
"src/helpers.php"
]
},
- "autoload-dev": {
- "psr-4": {
- "RalphJSmit\\Laravel\\SEO\\Tests\\": "tests"
+ "autoload-dev" : {
+ "psr-4" : {
+ "RalphJSmit\\Laravel\\SEO\\Tests\\" : "tests"
}
},
- "scripts": {
- "test": "vendor/bin/pest",
- "test-coverage": "vendor/bin/pest --coverage"
+ "scripts" : {
+ "test" : "vendor/bin/pest",
+ "test-coverage" : "vendor/bin/pest --coverage"
},
- "config": {
- "sort-packages": true,
- "allow-plugins": {
- "pestphp/pest-plugin": true
+ "config" : {
+ "sort-packages" : true,
+ "allow-plugins" : {
+ "pestphp/pest-plugin" : true
}
},
- "extra": {
- "laravel": {
- "providers": [
+ "extra" : {
+ "laravel" : {
+ "providers" : [
"RalphJSmit\\Laravel\\SEO\\LaravelSEOServiceProvider"
],
- "aliases": {
- "SEOManager": "RalphJSmit\\Laravel\\SEO\\Facades\\SEOManager"
+ "aliases" : {
+ "SEOManager" : "RalphJSmit\\Laravel\\SEO\\Facades\\SEOManager"
}
}
},
- "minimum-stability": "dev",
- "prefer-stable": true
+ "minimum-stability" : "dev",
+ "prefer-stable" : true
}