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

Renames the Code namespace and Composer/Packagist namespace #112

Merged
merged 5 commits into from
Jul 12, 2023
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
20 changes: 12 additions & 8 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
name: Check & fix styling
name: Fix PHP code style issues

on: [push]
on:
push:
paths:
- '**.php'

permissions:
contents: write

jobs:
php-cs-fixer:
php-code-styling:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
- name: Fix PHP code style issues
uses: aglipanci/[email protected]

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,12 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.0, 8.1, 8.2]
laravel: [8.*, 9.*, 10.*]
php: [8.1, 8.2]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*
- laravel: 8.*
testbench: "^6.24"
exclude:
- laravel: 10.*
php: 8.0
- laravel: 8.*
php: 8.2

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

Expand Down
21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "hotwired/turbo-laravel",
"name": "hotwired-laravel/turbo-laravel",
"description": "Turbo Laravel gives you a set of conventions to make the most out of the Hotwire stack (inspired by turbo-rails gem).",
"keywords": [
"hotwired",
"hotwire",
"turbo",
"turbo-laravel"
],
"homepage": "https://github.com/tonysm/turbo-laravel",
"homepage": "https://github.com/hotwired-laravel/turbo-laravel",
"license": "MIT",
"authors": [
{
Expand All @@ -18,22 +18,23 @@
}
],
"require": {
"php": "^8.0|^8.1",
"illuminate/support": "^8.47|^9.0|^10.0"
"php": "^8.1",
"illuminate/support": "^10.0"
},
"require-dev": {
"orchestra/testbench": "^6.24|^7.0|^8.0",
"laravel/pint": "^1.10",
"orchestra/testbench": "^8.0",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"Tonysm\\TurboLaravel\\": "src"
"HotwiredLaravel\\TurboLaravel\\": "src"
},
"files": ["src/helpers.php", "src/globals.php"]
},
"autoload-dev": {
"psr-4": {
"Tonysm\\TurboLaravel\\Tests\\": "tests"
"HotwiredLaravel\\TurboLaravel\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -47,11 +48,11 @@
"extra": {
"laravel": {
"providers": [
"\\Tonysm\\TurboLaravel\\TurboServiceProvider"
"\\HotwiredLaravel\\TurboLaravel\\TurboServiceProvider"
],
"aliases": {
"Turbo": "\\Tonysm\\TurboLaravel\\Facades\\Turbo",
"TurboStream": "\\Tonysm\\TurboLaravel\\Facades\\TurboStream"
"Turbo": "\\HotwiredLaravel\\TurboLaravel\\Facades\\Turbo",
"TurboStream": "\\HotwiredLaravel\\TurboLaravel\\Facades\\TurboStream"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion config/turbo-laravel.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Tonysm\TurboLaravel\Features;
use HotwiredLaravel\TurboLaravel\Features;

return [
/*
Expand Down
8 changes: 4 additions & 4 deletions docs/broadcasting.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ You may want to read the [Laravel Broadcasting](https://laravel.com/docs/broadca
With Laravel Echo properly configured, you may now broadcast model changes using WebSockets. First thing you need to do is use the `Broadcasts` trait in your model:

```php
use Tonysm\TurboLaravel\Models\Broadcasts;
use HotwiredLaravel\TurboLaravel\Models\Broadcasts;

class Comment extends Model
{
Expand Down Expand Up @@ -256,7 +256,7 @@ $comment->broadcastAppendTo($post)
Second, you can use the Turbo Facade like so:

```php
use Tonysm\TurboLaravel\Facades\Turbo;
use HotwiredLaravel\TurboLaravel\Facades\Turbo;

Turbo::broadcastToOthers(function () {
// ...
Expand All @@ -273,7 +273,7 @@ Third, you may use that same method but without the Closure inside a ServiceProv
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Tonysm\TurboLaravel\Facades\Turbo;
use HotwiredLaravel\TurboLaravel\Facades\Turbo;

class AppServiceProvider extends ServiceProvider
{
Expand All @@ -286,7 +286,7 @@ class AppServiceProvider extends ServiceProvider

## Handmade Broadcasts

You may want to broadcast something that does not depend on a model. You may do so using the `Tonysm\TurboLaravel\Facades\TurboStream` Facade (if you're not into Facades, type-hinting the `Tonysm\TurboLaravel\Broadcasting\Factory` class should also work):
You may want to broadcast something that does not depend on a model. You may do so using the `HotwiredLaravel\TurboLaravel\Facades\TurboStream` Facade (if you're not into Facades, type-hinting the `HotwiredLaravel\TurboLaravel\Broadcasting\Factory` class should also work):

```php
TurboStream::broadcastAppend(
Expand Down
8 changes: 4 additions & 4 deletions docs/helper-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The package ships with a set of helper functions. These functions are all namesp
The mentioned namespaced `dom_id()` helper function may also be used from anywhere in your application, like so:

```php
use function Tonysm\TurboLaravel\dom_id;
use function HotwiredLaravel\TurboLaravel\dom_id;

dom_id($comment);
```
Expand All @@ -25,7 +25,7 @@ These helpers strip out the model's FQCN (see [config/turbo-laravel.php](https:/
The `dom_class()` helper function may be used from anywhere in your application, like so:

```php
use function Tonysm\TurboLaravel\dom_class;
use function HotwiredLaravel\TurboLaravel\dom_class;

dom_class($comment);
```
Expand All @@ -45,7 +45,7 @@ This will generate a DOM class of `reactions_list_comment`.
You may generate Turbo Streams using the `Response::turboStream()` macro, but you may also do so using the `turbo_stream()` helper function:

```php
use function Tonysm\TurboLaravel\turbo_stream;
use function HotwiredLaravel\TurboLaravel\turbo_stream;

turbo_stream()->append($comment);
```
Expand All @@ -57,7 +57,7 @@ Both the `Response::turboStream()` and the `turbo_stream()` function work the sa
You may combo Turbo Streams using the `turbo_stream([])` function passing an array, but you may prefer to create a separate Blade view with all the Turbo Streams, this way you may also use template extensions and everything else Blade offers:

```php
use function Tonysm\TurboLaravel\turbo_stream_view;
use function HotwiredLaravel\TurboLaravel\turbo_stream_view;

return turbo_stream_view('comments.turbo.created', [
'comment' => $comment,
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Turbo Laravel may be installed via Composer:

```bash
composer require hotwired/turbo-laravel
composer require hotwired-laravel/turbo-laravel
```

After installing, you may execute the `turbo:install` Artisan command, which will add a couple JS dependencies to your `package.json` file (when you're using Vite and NPM) or to your `routes/importmap.php` file (when you're using [Importmap Laravel](https://github.com/tonysm/importmap-laravel)), publish some JS scripts to your `resources/js` folder that configure Turbo.js for you:
Expand Down
6 changes: 3 additions & 3 deletions docs/livewire.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To use it, all we need to do is add the CDN script after the Livewire Scripts, s

```blade
<!-- ... -->

@livewireScripts
<script src="https://cdn.jsdelivr.net/gh/livewire/[email protected]/dist/livewire-turbolinks.js" data-turbo-eval="false"></script>
</body>
Expand All @@ -36,11 +36,11 @@ use Livewire\Component;
class Counter extends Component
{
public $counter = 0;

public function increment()
{
$this->counter++;

$this->dispatchBrowserEvent('turboStreamFromLivewire', [
'message' => view('livewire.counter_stream', ['counter' => $this->counter])->render(),
]);
Expand Down
6 changes: 3 additions & 3 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ These methods are handy when you are conditionally returning Turbo Stream respon
You can test if you got a Turbo Stream response by using the `assertTurboStream`. Similarly, you can assert that your response is _not_ a Turbo Stream response by using the `assertNotTurboStream()` macro:

```php
use Tonysm\TurboLaravel\Testing\InteractsWithTurbo;
use HotwiredLaravel\TurboLaravel\Testing\InteractsWithTurbo;

class CreateTodosTest extends TestCase
{
Expand Down Expand Up @@ -104,8 +104,8 @@ All broadcasts use the `TurboStream` Facade. You may want to fake it so you can

```php
use App\Models\Todo;
use Tonysm\TurboLaravel\Facades\TurboStream;
use Tonysm\TurboLaravel\Broadcasting\PendingBroadcast;
use HotwiredLaravel\TurboLaravel\Facades\TurboStream;
use HotwiredLaravel\TurboLaravel\Broadcasting\PendingBroadcast;

class CreatesCommentsTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions docs/turbo-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (request()->wasFromTurboNative()) {
Or the Turbo Facade directly, like so:

```php
use Tonysm\TurboLaravel\Facades\Turbo;
use HotwiredLaravel\TurboLaravel\Facades\Turbo;

if (Turbo::isTurboNativeVisit()) {
// ...
Expand All @@ -47,7 +47,7 @@ Turbo is built to work with native navigation principles and present those along
You may want to use the provided `InteractsWithTurboNativeNavigation` trait on your controllers like so:

```php
use Tonysm\TurboLaravel\Http\Controllers\Concerns\InteractsWithTurboNativeNavigation;
use HotwiredLaravel\TurboLaravel\Http\Controllers\Concerns\InteractsWithTurboNativeNavigation;

class TraysController extends Controller
{
Expand Down
4 changes: 2 additions & 2 deletions docs/validation-response-redirects.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The package ships with a middleware which applies some conventions on your redir
**The middleware is automatically prepended to your web route group middleware stack**. You may want to add the middleware to other groups, when doing so, make sure it's at the top of the middleware stack:

```php
\Tonysm\TurboLaravel\Http\Middleware\TurboMiddleware::class,
\HotwiredLaravel\TurboLaravel\Http\Middleware\TurboMiddleware::class,
```

Like so:
Expand All @@ -73,7 +73,7 @@ class Kernel extends HttpKernel
{
protected $middlewareGroups = [
'web' => [
\Tonysm\TurboLaravel\Http\Middleware\TurboMiddleware::class,
\HotwiredLaravel\TurboLaravel\Http\Middleware\TurboMiddleware::class,
// other middlewares...
],
];
Expand Down
2 changes: 1 addition & 1 deletion routes/turbo.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use HotwiredLaravel\TurboLaravel\Http\Controllers\TurboNativeNavigationController;
use Illuminate\Support\Facades\Route;
use Tonysm\TurboLaravel\Http\Controllers\TurboNativeNavigationController;

Route::get('recede_historical_location', [TurboNativeNavigationController::class, 'recede'])->name('turbo_recede_historical_location');
Route::get('resume_historical_location', [TurboNativeNavigationController::class, 'resume'])->name('turbo_resume_historical_location');
Expand Down
20 changes: 9 additions & 11 deletions src/Broadcasters/Broadcaster.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<?php

namespace Tonysm\TurboLaravel\Broadcasters;
namespace HotwiredLaravel\TurboLaravel\Broadcasters;

use Illuminate\Broadcasting\Channel;

interface Broadcaster
{
/**
* @param Channel[] $channels
* @param bool $later
* @param string $action
* @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 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
*/
public function broadcast(
array $channels,
Expand Down
24 changes: 11 additions & 13 deletions src/Broadcasters/LaravelBroadcaster.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
<?php

namespace Tonysm\TurboLaravel\Broadcasters;
namespace HotwiredLaravel\TurboLaravel\Broadcasters;

use Tonysm\TurboLaravel\Jobs\BroadcastAction;
use HotwiredLaravel\TurboLaravel\Jobs\BroadcastAction;

class LaravelBroadcaster implements Broadcaster
{
/**
* @param \Illuminate\Broadcasting\Channel[] $channels
* @param bool $later
* @param string $action
* @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 \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
*/
public function broadcast(
array $channels,
Expand Down
4 changes: 2 additions & 2 deletions src/Broadcasting/Factory.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Tonysm\TurboLaravel\Broadcasting;
namespace HotwiredLaravel\TurboLaravel\Broadcasting;

use HotwiredLaravel\TurboLaravel\Models\Naming\Name;
use Illuminate\Broadcasting\Channel;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use PHPUnit\Framework\Assert;
use Tonysm\TurboLaravel\Models\Naming\Name;

class Factory
{
Expand Down
Loading