laravel-7-noteslisted
Install: claude install-skill hmj1026/dhpk
# Laravel 7 — HTTP client, custom casts, blade components
Released March 2020. **6-month support cycle** (not LTS). PHP 7.2.5+
floor.
---
## Signature features
### HTTP client wrapper (Http facade)
```php
$response = Http::withHeaders(['X-Trace' => $traceId])
->retry(3, 100)
->timeout(5)
->post('https://api.example.com/orders', ['sku' => $sku]);
if ($response->successful()) {
$order = $response->json('data');
}
```
Wraps Guzzle with a fluent Laravel API. Notable: built-in retry,
timeout, response mocking via `Http::fake()`. Strongly preferred over
direct Guzzle in new Laravel 7+ code — it integrates with Laravel's
logging, dump-and-die helpers, and test fakes.
### Custom Eloquent casts
```php
final class MoneyCast implements CastsAttributes
{
public function get($model, string $key, $value, array $attributes): Money
{
return Money::fromCents((int) $value);
}
public function set($model, string $key, $value, array $attributes): array
{
return [$key => $value instanceof Money ? $value->cents() : (int) $value];
}
}
// In the model:
protected $casts = ['price' => MoneyCast::class];
```
Before 7.0: accessor/mutator methods (`getPriceAttribute`,
`setPriceAttribute`) were the only path. CastsAttributes is cleaner
for value-object wrapping — reusable across models, testable in
isolation.
### Blade `x-component` syntax
```blade
{{-- resources/views/components/alert.blade.php --}}
<div class="alert alert-{{ $type }}">