oliverdavies.uk/content/node.dcae03b2-1838-4db7-9b1d-3fe87b70c19a.yml

79 lines
3.2 KiB
YAML

uuid:
- value: dcae03b2-1838-4db7-9b1d-3fe87b70c19a
langcode:
- value: en
type:
- target_id: daily_email
target_type: node_type
target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7
revision_timestamp:
- value: '2025-05-11T09:00:44+00:00'
revision_uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
revision_log: { }
status:
- value: true
uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
title:
- value: |
Laravel Pipelines
created:
- value: '2023-04-23T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:44+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2023/04/23/laravel-pipelines
langcode: en
body:
- value: |
<p>I've seen a lot on social media and posts and videos recently about Laravel Pipelines - functionality that's been present in Laravel and used within the framework for some time - but there was only documentation added for it last month as part of the Laravel 10 release.</p>
<p>This is an example from the new documentation:</p>
<pre><code class="language-php">$user = Pipeline::send($user)
-&gt;through([
GenerateProfilePhoto::class,
ActivateSubscription::class,
SendWelcomeEmail::class,
])
-&gt;then(fn (User $user) =&gt; $user);
</code></pre>
<p>Once a user has registered, it is passed through different classes - each performing a task and calling the next class in the list, similar to middleware. Once finished, a final action is performed or a value is returned.</p>
<p>As someone who doesn't use Laravel often but does use standalone components - like <code>illuminate/collections</code> - in other PHP projects, I'm interested to see how I can use this via <code>illuminate/pipeline</code> to refactor some of my existing code.</p>
format: full_html
processed: |
<p>I've seen a lot on social media and posts and videos recently about Laravel Pipelines - functionality that's been present in Laravel and used within the framework for some time - but there was only documentation added for it last month as part of the Laravel 10 release.</p>
<p>This is an example from the new documentation:</p>
<pre><code class="language-php">$user = Pipeline::send($user)
-&gt;through([
GenerateProfilePhoto::class,
ActivateSubscription::class,
SendWelcomeEmail::class,
])
-&gt;then(fn (User $user) =&gt; $user);
</code></pre>
<p>Once a user has registered, it is passed through different classes - each performing a task and calling the next class in the list, similar to middleware. Once finished, a final action is performed or a value is returned.</p>
<p>As someone who doesn't use Laravel often but does use standalone components - like <code>illuminate/collections</code> - in other PHP projects, I'm interested to see how I can use this via <code>illuminate/pipeline</code> to refactor some of my existing code.</p>
summary: null
field_daily_email_cta: { }