Skip to content

Commit

Permalink
Release [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricius committed Nov 6, 2022
1 parent 7a0b4e1 commit cff8490
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Changelog

All notable changes to `laravel-htmx` will be documented in this file.

## 0.2.0 - 2022-11-06

### What's Changed

- Added support for Laravel 8.80 and higher
- Renamed `fragment` macro to `renderFragment` due to `fragment` making its way into [Laravel's core](https://github.com/laravel/framework/pull/44774).

## 0.1.0 - 2022-11-02

- Initial release
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Laravel integration for [htmx](https://htmx.org/).
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/mauricius/laravel-htmx/run-tests?label=tests)](https://github.com/mauricius/laravel-htmx/actions?query=workflow%3Arun-tests+branch%3Amaster)
[![Total Downloads](https://img.shields.io/packagist/dt/mauricius/laravel-htmx.svg?style=flat-square)](https://packagist.org/packages/mauricius/laravel-htmx)

Supported Laravel Versions >= v8.80.0.

## Installation

You can install the package via composer:
Expand Down Expand Up @@ -167,7 +169,7 @@ Route::get('/', function ($id) {
});
```

Or we can render only the `archive-ui` fragment of the template by using the `fragment` macro defined in the `\Illuminate\View\View` class:
Or we can render only the `archive-ui` fragment of the template by using the `renderFragment` macro defined in the `\Illuminate\View\View` class:

```php
Route::patch('/contacts/{id}/unarchive', function ($id) {
Expand All @@ -176,17 +178,17 @@ Route::patch('/contacts/{id}/unarchive', function ($id) {
// The following approaches are equivalent

// Using the View Facade
return \Illuminate\Support\Facades\View::fragment('contacts.detail', 'archive-ui', compact('contact'));
return \Illuminate\Support\Facades\View::renderFragment('contacts.detail', 'archive-ui', compact('contact'));

// Using the view() helper
return view()->fragment('contacts.detail', 'archive-ui', compact('contact'));
return view()->renderFragment('contacts.detail', 'archive-ui', compact('contact'));

// Using the HtmxResponse Facade
return \Mauricius\LaravelHtmx\Facades\HtmxResponse::renderFragment('contacts.detail', 'archive-ui', compact('contact'));

// Using the HtmxResponse class
return with(new \Mauricius\LaravelHtmx\Http\HtmxResponse())
->fragment('contacts.detail', 'archive-ui', compact('contact'));

// Using the HtmxResponse Facade
return Mauricius\LaravelHtmx\Facades\HtmxResponse::fragment('contacts.detail', 'archive-ui', compact('contact'));
->renderFragment('contacts.detail', 'archive-ui', compact('contact'));
});
```

Expand Down

0 comments on commit cff8490

Please sign in to comment.