Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 11 Support #142

Merged
merged 9 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
php: [8.2]
laravel: [10.*]
laravel: [10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
workbench: 8.*
- laravel: 11.*
testbench: 9.*
workbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand All @@ -36,7 +40,7 @@ jobs:

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:^2.64.1" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "orchestra/workbench:${{ matrix.workbench }}" "nesbot/carbon:^2.64.1" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Execute tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.php_cs.cache
.php-cs-fixer.cache
.phpunit.result.cache
.phpunit.cache
build
composer.lock
coverage
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
],
"require": {
"php": "^8.2",
"illuminate/support": "^10.0"
"illuminate/support": "^10.0|^11.0"
},
"require-dev": {
"laravel/pint": "^1.10",
"orchestra/testbench": "^8.14",
"orchestra/workbench": "^1.0",
"phpunit/phpunit": "^9.6"
"orchestra/testbench": "^8.14|^9.0",
"orchestra/workbench": "^8.0|^9.0",
"phpunit/phpunit": "^10.5"
},
"autoload": {
"psr-4": {
Expand Down
14 changes: 2 additions & 12 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Turbo Laravel can be installed via [Composer](https://getcomposer.org/):

```bash
composer require hotwired-laravel/turbo-laravel:^2.0.0-beta1
composer require hotwired-laravel/turbo-laravel:^2.0.0
```

After installing the package, you may run the `turbo:install` Artisan command. This command will add the Turbo.js dependency to your `package.json` file (when you're using Vite and NPM) or to your `routes/importmap.php` file (when it detects that you're using [Importmap Laravel](https://github.com/tonysm/importmap-laravel)). It also publishes some files to your `resources/js` folder, which imports Turbo for you:
Expand All @@ -12,16 +12,6 @@ After installing the package, you may run the `turbo:install` Artisan command. T
php artisan turbo:install
```

If you're using [Laravel Jetstream](https://jetstream.laravel.com/introduction.html) with [Livewire](https://livewire.laravel.com/), you may add the `--jet` flag to the `turbo:install` Artisan command. This flag will add some required JS dependencies to make sure [Alpine.js](https://alpinejs.dev/) works well with Turbo. It also changes the layout files that ships with Jetstream adding the [Livewire Turbo Plugin](https://github.com/livewire/turbolinks) to make sure Livewire works well with Turbo, too:

```bash
php artisan turbo:install --jet
```

If you're using [Alpine.js](https://alpinejs.dev/) in a non-Jetstream context (maybe you're more into [Breeze](https://laravel.com/docs/starter-kits#laravel-breeze)), you may use the `--alpine` flag in the `turbo:install` Artisan command:

```bash
php artisan turbo:install --alpine
```
Note: Turbo used to work with Livewire, but somewhere around Livewire V3 the bridges stopped working. There's an open issue to investigate Livewire V3 compatibility. If you're into Livewire and would love to use Turbo in a Livewire app (maybe you want to augment your Livewire&Turbo app with Turbo Native or something like that), you're welcome to check out the issue and try to bring the compatibility back. If you wanted an application scaffolding like Laravel Breeze or Laravel Jetstream, checkout Turbo Breeze, our fork of Breeze that sets up a fresh Laravel app using Stimulus, Importmaps, TailwindCSS (via the CLI), and Turbo.

[Continue to Overview...](/docs/{{version}}/overview)
39 changes: 17 additions & 22 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
bootstrap="vendor/autoload.php"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<testsuites>
<testsuite name="Turbo Laravel Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
<junit outputFile="build/report.junit.xml" />
</logging>
<php>
<env name="APP_KEY" value="a2ps3dFoNmyehsm7r0VFZ0Iq64hwBpqI"/>
<env name="APP_KEY" value="a2ps3dFoNmyehsm7r0VFZ0Iq64hwBpqI" />
</php>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
1 change: 1 addition & 0 deletions resources/views/components/page-view-transition.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta name="view-transition" content="same-origin" />
14 changes: 7 additions & 7 deletions src/Broadcasters/Broadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ interface Broadcaster
{
/**
* @param Channel[] $channels
* @param ?string $target = null
* @param ?string $targets = null
* @param ?string $partial = null
* @param ?array $partialData = []
* @param ?string $inlineContent = null
* @param bool $escapeInlineContent = true
* @param ?string $exceptSocket = null
* @param ?string $target = null
* @param ?string $targets = null
* @param ?string $partial = null
* @param ?array $partialData = []
* @param ?string $inlineContent = null
* @param bool $escapeInlineContent = true
* @param ?string $exceptSocket = null
*/
public function broadcast(
array $channels,
Expand Down
16 changes: 8 additions & 8 deletions src/Broadcasters/LaravelBroadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ class LaravelBroadcaster implements Broadcaster
{
/**
* @param \Illuminate\Broadcasting\Channel[] $channels
* @param ?string $target = null
* @param ?string $targets = null
* @param ?string $partial = null
* @param ?array $partialData = []
* @param ?string $inlineContent = null
* @param bool $escapeInlineContent = true
* @param array $attributes = []
* @param ?string $exceptSocket = null
* @param ?string $target = null
* @param ?string $targets = null
* @param ?string $partial = null
* @param ?array $partialData = []
* @param ?string $inlineContent = null
* @param bool $escapeInlineContent = true
* @param array $attributes = []
* @param ?string $exceptSocket = null
*/
public function broadcast(
array $channels,
Expand Down
46 changes: 0 additions & 46 deletions src/Commands/Tasks/EnsureLivewireTurboBridgeExists.php

This file was deleted.

Loading
Loading