Skip to content

Commit

Permalink
Update package to version 3.* to match Laravel framework version 8.*
Browse files Browse the repository at this point in the history
  • Loading branch information
Frano committed Nov 23, 2020
1 parent 922413c commit 483ef88
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# CHANGELOG

## v3.0.0 (2020-11-23)

### Added
- Added support for Laravel 8.x version
- Added support for PHP 8.0 version

## v2.0.2 (2020-04-01)

### Added
- Added support for Laravel 7.x version

## v1.1.0 (2019-12-19)

### Fixed
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Laravel Trailing Slash

Adds url formatting and redirection with trailing slash to Laravel 7.x, 6.x and 5.x.
Adds url formatting and redirection with trailing slash to Laravel framework versions 8.x, 7.x, 6.x and 5.x.

[![Build For Laravel](https://img.shields.io/badge/Built_for-Laravel-orange.svg)](https://styleci.io/repos/79834672)
[![Latest Stable Version](https://poser.pugx.org/fsasvari/laravel-trailing-slash/v/stable)](https://packagist.org/packages/fsasvari/laravel-trailing-slash)
Expand All @@ -10,13 +10,14 @@ Adds url formatting and redirection with trailing slash to Laravel 7.x, 6.x and

## Compatibility Chart

| Laravel Trailing Slash | Laravel | PHP |
|-----------------------------------------------------------------------|-----------|---------|
| [2.x](https://github.com/fsasvari/laravel-trailing-slash/tree/v2.0.2) | 7.x | 7.3+ |
| [1.x](https://github.com/fsasvari/laravel-trailing-slash/tree/v1.1.0) | 6.x | 7.2+ |
| [0.3.x](https://github.com/fsasvari/laravel-trailing-slash/tree/0.3) | 5.7-5.8 | 7.1.3+ |
| [0.2.x](https://github.com/fsasvari/laravel-trailing-slash/tree/0.2) | 5.6 | 7.1.3+ |
| [0.1.x](https://github.com/fsasvari/laravel-trailing-slash/tree/0.1) | 5.5 | 7.0.0+ |
| Laravel Trailing Slash | Laravel | PHP |
|-----------------------------------------------------------------------|-----------|------------|
| [3.x](https://github.com/fsasvari/laravel-trailing-slash/tree/v3.0.0) | 8.x | 7.3+/8.0+ |
| [2.x](https://github.com/fsasvari/laravel-trailing-slash/tree/v2.0.2) | 7.x | 7.3+ |
| [1.x](https://github.com/fsasvari/laravel-trailing-slash/tree/v1.1.0) | 6.x | 7.2+ |
| [0.3.x](https://github.com/fsasvari/laravel-trailing-slash/tree/0.3) | 5.7-5.8 | 7.1.3+ |
| [0.2.x](https://github.com/fsasvari/laravel-trailing-slash/tree/0.2) | 5.6 | 7.1.3+ |
| [0.1.x](https://github.com/fsasvari/laravel-trailing-slash/tree/0.1) | 5.5 | 7.0.0+ |

## Installation

Expand All @@ -31,7 +32,7 @@ composer require fsasvari/laravel-trailing-slash
Or add it directly by copying next line into composer.json:

```
"fsasvari/laravel-trailing-slash": "2.*"
"fsasvari/laravel-trailing-slash": "3.*"
```

### Step 2: Service Provider
Expand Down Expand Up @@ -101,7 +102,7 @@ Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recen

## Notice

There is a problem with overriding Laravel's `Paginator` and `LengthAwarePaginator` classes. So, every time you use `paginate()` method on your models, query builders etc., you must set current path for pagination links. Example:
There is a problem with overriding Laravel `Paginator` and `LengthAwarePaginator` classes. So, every time you use `paginate()` method on your models, query builders etc., you must set current path for pagination links. Example:

```php
$texts = Text::where('is_active', 1)->paginate();
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fsasvari/laravel-trailing-slash",
"description": "Adds redirection with trailing slash in Laravel.",
"description": "The package that adds redirection with trailing slash to Laravel framework.",
"keywords": ["redirect", "laravel", "php"],
"license": "MIT",
"homepage": "https://github.com/fsasvari/laravel-trailing-slash",
Expand All @@ -11,12 +11,12 @@
}
],
"require": {
"php": "^7.3",
"illuminate/routing": "7.*"
"php": "^7.3|^8.0",
"illuminate/routing": "8.*"
},
"require-dev": {
"mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^9.0"
"mockery/mockery": "^1.4.2",
"phpunit/phpunit": "^9.4.3"
},
"autoload": {
"psr-4": {
Expand Down
38 changes: 12 additions & 26 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
<testsuites>
<testsuite name="Laravel Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<directory suffix=".blade.php">./src/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="tests/bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnError="false" stopOnFailure="false" verbose="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Laravel Trailing Slash Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion src/RoutingServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected function registerUrlGenerator()
// get the information it needs to function. This just provides some of
// the convenience features to this URL generator like "signed" URLs.
$url->setSessionResolver(function () use ($app) {
return $app['session'];
return $app['session'] ?? null;
});

$url->setKeyResolver(function () use ($app) {
Expand Down
4 changes: 3 additions & 1 deletion src/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class UrlGenerator extends BaseUrlGenerator
*/
public function format($root, $path, $route = null)
{
return parent::format($root, $path, $route).(Str::contains($path, '#') ? '' : '/');
$trailingSlash = (Str::contains($path, '#') ? '' : '/');

return rtrim(parent::format($root, $path, $route), '/').$trailingSlash;
}
}

0 comments on commit 483ef88

Please sign in to comment.