Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
ce2dbbd
Extract homepage header component
emmadesilva Sep 28, 2025
0ee3629
Create new homepage header concept
emmadesilva Sep 28, 2025
04c64a5
Tweak colors
emmadesilva Sep 28, 2025
790d785
Tweak colors more
emmadesilva Sep 28, 2025
1a10d72
Tweak heading
emmadesilva Sep 28, 2025
b515ae2
Manual tweaks
emmadesilva Sep 28, 2025
f00ef58
More tweaks
emmadesilva Sep 28, 2025
f12bb24
Glass navigation
emmadesilva Sep 28, 2025
311c97c
Manual tweaks
emmadesilva Sep 28, 2025
6d3965f
Tweaks
emmadesilva Sep 28, 2025
8f8d871
Style tweaks
emmadesilva Sep 28, 2025
7ccc15f
Implement links
emmadesilva Sep 28, 2025
dec844f
Same site host
emmadesilva Sep 28, 2025
bfd51b3
Build the site
emmadesilva Sep 28, 2025
0e384b9
Prettier homepage
emmadesilva Sep 28, 2025
f3d2d95
More prettifications
emmadesilva Sep 28, 2025
cfc5651
Extract sections
emmadesilva Sep 28, 2025
1b2d9e0
Reorders
emmadesilva Sep 28, 2025
16ee3c5
Fix spacings
emmadesilva Sep 28, 2025
8dae13e
Tweak waves
emmadesilva Sep 28, 2025
d8e419b
Tweaks
emmadesilva Sep 28, 2025
216610a
Fix border issue
emmadesilva Sep 28, 2025
6c89f22
Fix color leaking
emmadesilva Sep 28, 2025
553fe7c
Improve responsiveness
emmadesilva Sep 28, 2025
d58d20a
Tweaks
emmadesilva Sep 28, 2025
a3885a6
Darken section
emmadesilva Sep 28, 2025
cf9513a
Lighten section
emmadesilva Sep 28, 2025
14a61b3
Tweak colors
emmadesilva Sep 28, 2025
664de20
Stats card for features
emmadesilva Sep 28, 2025
37f165a
Smart grids
emmadesilva Sep 28, 2025
e49a82f
Super cool how it works page
emmadesilva Sep 28, 2025
293b4ba
Widescreen and tweaks
emmadesilva Sep 28, 2025
04698f2
Fix width
emmadesilva Sep 28, 2025
c4f821f
Add some inertia
emmadesilva Sep 28, 2025
496d74a
Scroll tweaks
emmadesilva Sep 29, 2025
8397f2c
Tweaks
emmadesilva Sep 29, 2025
1d44592
Tweaks
emmadesilva Sep 29, 2025
c3a199c
Add files via upload
emmadesilva Sep 29, 2025
75ea5b3
Add announcement for Laravel Meetup Stockholm talk
emmadesilva Sep 29, 2025
e63cd7a
Build the site
emmadesilva Sep 29, 2025
d318b22
Delete _pages/hydephp-creator-speaking-at-the-laravel-meetup-stockhol…
emmadesilva Sep 29, 2025
7337430
Add files via upload
emmadesilva Sep 29, 2025
59d30f1
Build the site
emmadesilva Sep 29, 2025
350a96a
Create banner
emmadesilva Sep 29, 2025
eb25bb3
Fix image reference and formatting
emmadesilva Sep 29, 2025
aaa4020
Build the site
emmadesilva Sep 29, 2025
998bed8
Revise title and description for Laravel Meetup event
emmadesilva Sep 29, 2025
89d7303
Build the site
emmadesilva Sep 29, 2025
401eee3
Fix image syntax in meetup announcement post
emmadesilva Sep 29, 2025
ea39166
Build the site
emmadesilva Sep 29, 2025
a59abed
Fix image path in Laravel Meetup Stockholm post
emmadesilva Sep 29, 2025
2437258
Build the site
emmadesilva Sep 29, 2025
8528eec
Update title and image path in meetup post
emmadesilva Sep 29, 2025
baa7c8e
Fixes
emmadesilva Sep 29, 2025
94816e2
Build the site
emmadesilva Sep 29, 2025
1f5e93e
Fix image path in Laravel Meetup Stockholm post
emmadesilva Sep 29, 2025
aa220ba
Build the site
emmadesilva Sep 29, 2025
2e3e5ea
Meetup banner
emmadesilva Sep 29, 2025
08b6e02
Merge branch 'master' of https://github.com/hydephp/hydephp.com
emmadesilva Sep 29, 2025
a9f60a2
Smaller image
emmadesilva Sep 29, 2025
6fa5f6f
Build the site
emmadesilva Sep 29, 2025
c1682c0
Build assets
emmadesilva Sep 29, 2025
1e8e4c8
Merge branch 'master' of https://github.com/hydephp/hydephp.com
emmadesilva Sep 29, 2025
756b559
Build the site
emmadesilva Sep 29, 2025
f05a8fa
Fix colors
emmadesilva Sep 29, 2025
062358d
Build the site
emmadesilva Sep 29, 2025
f514edd
Dual environment build command
emmadesilva Sep 29, 2025
f66b18f
Commit files
emmadesilva Sep 29, 2025
cce3c3b
Sync documentation
emmadesilva Sep 29, 2025
44e4266
Refactor the code
emmadesilva Sep 29, 2025
a6ac272
Configure documentation pages for 2.x
emmadesilva Sep 29, 2025
3be5beb
Build documentation pages for 2.x
emmadesilva Sep 29, 2025
696fac6
Add version configuration
emmadesilva Sep 29, 2025
4da31a0
Create extension to support multiple documentation versions!
emmadesilva Sep 29, 2025
c500ceb
Commit 1.x docs
emmadesilva Sep 29, 2025
deb48f8
Publish documentation layout
emmadesilva Sep 29, 2025
031e59c
Documentation version switcher
emmadesilva Sep 29, 2025
225c41b
Documentation version banner
emmadesilva Sep 29, 2025
e197f83
Update app.css
emmadesilva Sep 29, 2025
8ed30cd
Smoother search button
emmadesilva Sep 29, 2025
1eb3b8a
Search section fixes
emmadesilva Sep 29, 2025
2472e46
Publish mobile-navigation.blade.php
emmadesilva Sep 29, 2025
ddcb090
Mobile version switcher
emmadesilva Sep 29, 2025
bee1876
Tweak version selector
emmadesilva Sep 29, 2025
d76c270
Tweak banner
emmadesilva Sep 29, 2025
5e29262
Disable upcoming for now
emmadesilva Sep 29, 2025
9b61adf
Use set path
emmadesilva Sep 29, 2025
ae04352
Clear data directory
emmadesilva Sep 29, 2025
d951a92
Resync documentation
emmadesilva Sep 30, 2025
82f44d1
Fix page showing up in navigation
emmadesilva Sep 30, 2025
e66aa21
Create new documentation theme
emmadesilva Sep 30, 2025
cfe7a08
Tweak scrollbar
emmadesilva Sep 30, 2025
91373b0
Tweak headings
emmadesilva Sep 30, 2025
f4f2e95
Disable sidebar footer
emmadesilva Sep 30, 2025
1357cbe
Publish documentation-article.blade.php
emmadesilva Sep 30, 2025
640dc22
Move switcher
emmadesilva Sep 30, 2025
700a6c2
Smoother version banner
emmadesilva Sep 30, 2025
d81defb
Tweak banner
emmadesilva Sep 30, 2025
f6e0688
Tweak alignment
emmadesilva Sep 30, 2025
b3e26db
Tweak sidebar
emmadesilva Sep 30, 2025
271490e
Sync docs
emmadesilva Sep 30, 2025
d5dfc85
Update Composer dependencies
emmadesilva Sep 30, 2025
2100237
Upgrade NPM dependencies
emmadesilva Oct 1, 2025
3bf310e
Update frontend configuration
emmadesilva Oct 1, 2025
1c8ef38
Run Tailwind upgrade script
emmadesilva Oct 1, 2025
d4b5d5e
Build assets for v2
emmadesilva Oct 1, 2025
ef8c5c9
Migrate configuration
emmadesilva Oct 1, 2025
a1c1756
Update renamed code
emmadesilva Oct 1, 2025
e468eed
Build assets with Vite
emmadesilva Oct 1, 2025
e1d265a
Update Author schema
emmadesilva Oct 1, 2025
7fd1653
Last migration fixes
emmadesilva Oct 1, 2025
1988412
Build site with HydePHP v2
emmadesilva Oct 1, 2025
02f46ea
Merge pull request #116 from hydephp/upgrade-to-v2
emmadesilva Oct 1, 2025
b18ff9b
Merge branch 'upgrade-to-v2' into dual-documentation-versions
emmadesilva Oct 1, 2025
ad4dbf6
Update components to v2
emmadesilva Oct 1, 2025
f475abf
Merge pull request #115 from hydephp/dual-documentation-versions
emmadesilva Oct 1, 2025
ab1936b
Merge pull request #118 from hydephp/v2-website-updates
emmadesilva Oct 1, 2025
0a29584
Update build.yml
emmadesilva Oct 1, 2025
7d38a6c
HOTPATCH: Disable failing calls
emmadesilva Oct 1, 2025
5c33c7f
Manual site build
emmadesilva Oct 1, 2025
f1aea1e
Build the site
emmadesilva Oct 1, 2025
85902db
Fix duplicate items in sidebar
emmadesilva Oct 2, 2025
270bd10
Merge branch 'master' of https://github.com/hydephp/hydephp.com
emmadesilva Oct 2, 2025
6b2c0c8
Build the site
emmadesilva Oct 2, 2025
5e2f5f5
Announce HydePHP v2.0 release and update site banner
emmadesilva Oct 2, 2025
25ed5b7
Disable saving preview pages in output directory
emmadesilva Oct 2, 2025
d0014f9
Build the site
emmadesilva Oct 2, 2025
6e386b6
Merge branch 'master' into new-homepage
emmadesilva Oct 2, 2025
7312bab
Update to v2
emmadesilva Oct 2, 2025
2a1af67
Fix banner conflict
emmadesilva Oct 2, 2025
9d59076
Spacing tweaks
emmadesilva Oct 2, 2025
c18a36d
Formatting
emmadesilva Oct 2, 2025
dc54b88
Features flip card concept
emmadesilva Oct 2, 2025
6b66f9f
Tone down scroll fixes
emmadesilva Oct 2, 2025
c834850
Add padding reset for torchlight enabled code blocks
emmadesilva Oct 2, 2025
8ae3bd8
Add padding reset for torchlight enabled code blocks
emmadesilva Oct 2, 2025
104e64b
Merge branch 'master' of https://github.com/hydephp/hydephp.com
emmadesilva Oct 2, 2025
518abd9
Build the site
emmadesilva Oct 2, 2025
1f8bbff
Simpler Opus concept
emmadesilva Oct 2, 2025
888080e
Clean up concept
emmadesilva Oct 3, 2025
a922dc0
Update app.css
emmadesilva Oct 3, 2025
0f4572c
Build the site
emmadesilva Oct 3, 2025
8af7931
Update app.css
emmadesilva Oct 3, 2025
d2b4135
Update app.css
emmadesilva Oct 3, 2025
9a5dd61
Build the site
emmadesilva Oct 3, 2025
d69b0ad
Tweak height
emmadesilva Oct 3, 2025
7f0a90f
Merge branch 'master' of https://github.com/hydephp/hydephp.com
emmadesilva Oct 3, 2025
281de9d
Build the site
emmadesilva Oct 3, 2025
0850c44
Tweaks
emmadesilva Oct 3, 2025
b0e4e4c
Merge branch 'master' into new-homepage
emmadesilva Oct 3, 2025
edbb3b0
Build the site
emmadesilva Oct 3, 2025
a5f7e0f
Update quick-start.blade.php
emmadesilva Oct 3, 2025
1a4b57d
Update how-it-works.blade.php
emmadesilva Oct 3, 2025
3b7cd7b
Scroll animation
emmadesilva Oct 3, 2025
19bcbb7
Update testimonials.blade.php
emmadesilva Oct 3, 2025
c542667
Update who-its-for.blade.php
emmadesilva Oct 3, 2025
744e51c
More live scroll
emmadesilva Oct 3, 2025
187d912
Update testimonials.blade.php
emmadesilva Oct 3, 2025
9ef17ee
Fixes
emmadesilva Oct 3, 2025
922977c
Morph
emmadesilva Oct 3, 2025
afdf5ee
Fix header
emmadesilva Oct 3, 2025
a8b1ede
Remove distracting header
emmadesilva Oct 3, 2025
5e12a34
Display current date
emmadesilva Oct 3, 2025
23f3c11
Remove progress indicators from how-it-works section
emmadesilva Oct 4, 2025
41d3c2a
Sync pages
emmadesilva Oct 4, 2025
9831e21
Build the site
emmadesilva Oct 4, 2025
3532ae8
Merge branch 'master' into new-homepage
emmadesilva Oct 4, 2025
b53e432
Update browser header layout
emmadesilva Oct 4, 2025
fb0af3f
Update docs redirect to point to /docs/2.x
emmadesilva Oct 4, 2025
3e46eed
Merge branch 'master' into new-homepage
emmadesilva Oct 4, 2025
71b1c9f
Build the site
emmadesilva Oct 4, 2025
6ba5772
Snapping
emmadesilva Oct 4, 2025
f80d060
Update composer.lock
emmadesilva Oct 4, 2025
b71377f
Build the site
emmadesilva Oct 4, 2025
ec79a57
Remove inline style from logo image
emmadesilva Oct 4, 2025
8cd305e
Build the site
emmadesilva Oct 4, 2025
92c5b62
Update community files
github-actions[bot] Oct 5, 2025
2822ace
Merge branch 'master' into new-homepage
emmadesilva Oct 5, 2025
bba71a2
Refactor 'How It Works' layout for improved structure
emmadesilva Oct 5, 2025
97adf58
Improve mobile responsiveness for 'How It Works' section
emmadesilva Oct 5, 2025
a26899a
Add live Markdown editor to 'How It Works' section
emmadesilva Oct 5, 2025
a7d457b
Add front matter parsing to live markdown editor
emmadesilva Oct 5, 2025
de54f81
Add adaptive debounce and dynamic editor initialization
emmadesilva Oct 5, 2025
4b59cc7
Add live syntax highlighting to markdown editor
emmadesilva Oct 5, 2025
44b0b02
Remove adaptive debounce from markdown preview
emmadesilva Oct 5, 2025
550c006
Expand sidebar width in live code editor
emmadesilva Oct 5, 2025
269fdb0
Adjust layout and spacing in how-it-works section
emmadesilva Oct 5, 2025
debbb36
Update headings in how-it-works section
emmadesilva Oct 5, 2025
1618bf1
Refine feature card styles and layout
emmadesilva Oct 5, 2025
dfd8c34
Update feature section styles and code examples
emmadesilva Oct 5, 2025
7150257
Add syntax highlighting to code examples
emmadesilva Oct 5, 2025
78e374c
Remove example labels from feature cards
emmadesilva Oct 5, 2025
d8a8861
Improve feature cards layout and code samples
emmadesilva Oct 5, 2025
4ffbea2
Scope flip-card min-height to larger screens
emmadesilva Oct 5, 2025
851ba7b
Create banner.png
emmadesilva Oct 5, 2025
da10244
Build the site
emmadesilva Oct 5, 2025
7938700
Merge branch 'master' into new-homepage
emmadesilva Oct 5, 2025
6d4f63d
Update social meta image URLs to new banner
emmadesilva Oct 5, 2025
be6f2e5
Update app.css
emmadesilva Oct 5, 2025
4419aa4
Merge branch 'master' into new-homepage
emmadesilva Oct 5, 2025
10c74e6
Simplify navigation link rendering and classes
emmadesilva Oct 5, 2025
23b95e4
Improve docs button visibility on small screens
emmadesilva Oct 5, 2025
0beafbb
Merge pull request #114 from hydephp/new-homepage
emmadesilva Oct 5, 2025
3d96506
Build the site
emmadesilva Oct 5, 2025
d709c19
Disable site banner in hyde.yml
emmadesilva Oct 5, 2025
8a24892
Build the site
emmadesilva Oct 5, 2025
dcaaa76
Add progress bar animation on viewport entry
emmadesilva Oct 5, 2025
758c863
Dynamically set date in code example and editor
emmadesilva Oct 5, 2025
c48044b
Merge branch 'master' of https://github.com/hydephp/hydephp.com
emmadesilva Oct 5, 2025
b9e6231
Build the site
emmadesilva Oct 5, 2025
e85fb8f
Add mobile flip interaction to feature cards
emmadesilva Oct 5, 2025
8ff272c
Build the site
emmadesilva Oct 5, 2025
5dc85c4
Revert "Add mobile flip interaction to feature cards"
emmadesilva Oct 5, 2025
bf93e5a
Build the site
emmadesilva Oct 5, 2025
c1a7634
Fix wrong version in links
emmadesilva Oct 6, 2025
4f55915
Merge branch 'master' of https://github.com/hydephp/hydephp.com
emmadesilva Oct 6, 2025
c512e27
Build the site
emmadesilva Oct 6, 2025
030e390
Update app.css
emmadesilva Oct 6, 2025
d0d7c84
Build the site
emmadesilva Oct 6, 2025
0809eb3
Add heading permalinks configuration to markdown
emmadesilva Oct 6, 2025
6594b4f
Merge branch 'master' of https://github.com/hydephp/hydephp.com
emmadesilva Oct 6, 2025
0a96cc4
Build the site
emmadesilva Oct 6, 2025
4b4ac10
Fix versioned search indexes
emmadesilva Oct 19, 2025
8e0f5bb
Build the site
emmadesilva Oct 19, 2025
bd81e00
Build the site
emmadesilva Oct 26, 2025
3dbc11c
Edit testimonial content in 4.md
yanikkumar Oct 29, 2025
f41a13c
Add testimonial for EmmaDSCodes
yanikkumar Oct 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,16 @@ jobs:
run: npm install

- name: Build frontend assets
run: npm run prod
run: npm run build

- name: Download the latest community files
run: php hyde download-community-files

- name: Download the latest documentation files
run: php hyde docs:download

- name: Run the Hyde Builder
run: php hyde build --pretty-urls --run-prettier --no-interaction
run: php hyde build --pretty-urls --no-interaction

- name: Create .nojekyll
run: touch docs/.nojekyll
Expand All @@ -76,7 +79,7 @@ jobs:
run: cp docs/media/favicon.ico docs/favicon.ico

- name: Create docs redirect
run: echo '<meta http-equiv="refresh" content="0;url=/docs/1.x" />' > docs/docs/index.html
run: echo '<meta http-equiv="refresh" content="0;url=/docs/2.x" />' > docs/docs/index.html

- name: Commit changes
uses: EndBug/add-and-commit@v9
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
run: npm install

- name: Build frontend assets
run: npm run prod
run: npm run build

- name: Output debug information
run: |
Expand All @@ -71,7 +71,7 @@ jobs:
run: php hyde build --pretty-urls --no-interaction

- name: Create docs redirect
run: echo '<meta http-equiv="refresh" content="0;url=/docs/1.x" />' > _site/docs/index.html
run: echo '<meta http-equiv="refresh" content="0;url=/docs/2.x" />' > _site/docs/index.html

- name: Package the static site
run: zip -r site.zip _site
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: php hyde build --pretty-urls --no-interaction

- name: Create docs redirect
run: echo '<meta http-equiv="refresh" content="0;url=/docs/1.x" />' > _site/docs/index.html
run: echo '<meta http-equiv="refresh" content="0;url=/docs/2.x" />' > _site/docs/index.html

- name: Run tests
run: php bin/build-tests.php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ abstract class HydePage

>warning <p class="p-2" style="padding-right: 1rem"><strong>Heads up!</strong> The following methods are defined in the <code>HydePage</code> class, and are thus available to all page classes. Since the HydePage class is abstract, you cannot instantiate it directly, and many of the static methods are also only callable from the child classes.</p>

[Blade]: {{ Hyde\Markdown\Models\Markdown::fromFile(DocumentationPage::sourcePath('_data/partials/hyde-pages-api/hyde-page-methods'))->toHtml($page::class) }}

[Blade]: {{ Hyde\Markdown\Models\Markdown::fromFile(DocumentationPage::sourcePath('_data/partials/hyde-pages-api/interacts-with-front-matter-methods'))->toHtml($page::class) }}

## BaseMarkdownPage

Expand Down Expand Up @@ -144,7 +142,6 @@ abstract class BaseMarkdownPage extends HydePage

### Methods

[Blade]: {{ Hyde\Markdown\Models\Markdown::fromFile(DocumentationPage::sourcePath('_data/partials/hyde-pages-api/base-markdown-page-methods'))->toHtml($page::class) }}

## InMemoryPage

Expand Down Expand Up @@ -187,7 +184,6 @@ class InMemoryPage extends HydePage

### Methods

[Blade]: {{ Hyde\Markdown\Models\Markdown::fromFile(DocumentationPage::sourcePath('_data/partials/hyde-pages-api/in-memory-page-methods'))->toHtml($page::class) }}

## BladePage

Expand Down Expand Up @@ -215,7 +211,6 @@ class BladePage extends HydePage

### Methods

[Blade]: {{ Hyde\Markdown\Models\Markdown::fromFile(DocumentationPage::sourcePath('_data/partials/hyde-pages-api/blade-page-methods'))->toHtml($page::class) }}

## MarkdownPage

Expand Down Expand Up @@ -277,7 +272,6 @@ class MarkdownPost extends BaseMarkdownPage

### Methods

[Blade]: {{ Hyde\Markdown\Models\Markdown::fromFile(DocumentationPage::sourcePath('_data/partials/hyde-pages-api/markdown-post-methods'))->toHtml($page::class) }}

## DocumentationPage

Expand Down Expand Up @@ -305,7 +299,6 @@ class DocumentationPage extends BaseMarkdownPage

### Methods

[Blade]: {{ Hyde\Markdown\Models\Markdown::fromFile(DocumentationPage::sourcePath('_data/partials/hyde-pages-api/documentation-page-methods'))->toHtml($page::class) }}

## HtmlPage

Expand Down Expand Up @@ -333,4 +326,3 @@ class HtmlPage extends HydePage

### Methods

[Blade]: {{ Hyde\Markdown\Models\Markdown::fromFile(DocumentationPage::sourcePath('_data/partials/hyde-pages-api/html-page-methods'))->toHtml($page::class) }}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ following the upgrade guide for each version. After following the upgrade guide,
Updating a minor or patch version is easy using Composer. Just run the following command:

```bash
composer update hyde/* --with-dependencies
composer update "hyde/*" --with-dependencies
```

Note that if you have hardcoded a version constraint in your `composer.json` file, you may need to update it manually.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ Torchlight is an amazing API for syntax highlighting, and is supported natively
## Contribute

Have an idea for an extension or integration? Let me know! I'd love to hear from you. Get in touch on
[GitHub](https://github.com/hydephp/hyde) or send me a DM on [Twitter](https://twitter.com/EmmaDSCodes).
[GitHub](https://github.com/hydephp/hyde) or send me a DM on [Twitter](https://twitter.com/CodeWithCaen).
You may also want to look at the [Extension API](extensions-api) documentation to learn how to create extensions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions _docs/2.x/advanced-features/advanced-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
navigation:
label: Introduction
priority: 40
---

# Advanced Features in HydePHP

## Preface

HydePHP is a simple, yet powerful, static site generator. It is designed to be easy to use and easy to extend.

This section of the documentation will cover some of the more advanced (but optional) features of the framework.

## Prerequisites

To fully understand the features described in these chapters, it may be beneficial to first skim through the
[Architecture Concepts](architecture-concepts) chapters, or at the very least, the [Core Concepts](core-concepts) page.

You are also expected to have a basic understanding of PHP, and object-oriented programming principles.

Having some familiarity with Laravel will also be beneficial, as HydePHP is built on top of the Laravel framework.

## Table of Contents

[Blade]: <ul>@foreach(glob(DocumentationPage::path('advanced-features/*.md')) as $file) <li> <a href="{{ basename($file, '.md') }}.html"> {{ Hyde::makeTitle(basename($file, '.md')) }} </a> </li> @endforeach</ul>
191 changes: 191 additions & 0 deletions _docs/2.x/advanced-features/build-tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Custom Build Tasks

## Introduction

The Build Task API offers a simple way to hook into the build process.
The build tasks are very powerful and allow for limitless customizability.

The built-in Hyde features like sitemap generation and RSS feeds are created using tasks like these.
Maybe you want to create your own, to for example upload the site to FTP or copy the files to a public directory?
You can also overload the built-in tasks to customize them to your needs.

## Good to know before you start

### Types of tasks

There are two types, PreBuildTasks and PostBuildTasks. As the names suggest, PreBuildTasks are executed before the site is built, and PostBuildTasks are executed after the site is built.

To choose which type of task you want to create, you extend either the `PreBuildTask` or `PostBuildTask` class.
Both of these have the exact same helpers and API available, so the only difference between them is when they are executed. The classes are otherwise identical.

### About these examples

For most of these examples we will focus on the PostBuildTasks as they are the most common.

For all these examples we assume you put the file in the `App/Actions` directory, but you can put them anywhere.

### Interacting with output

In a way, build tasks are like micro-commands, as they can interact directly with the build commands I/O. Please take a look at the [Laravel Console Documentation](https://laravel.com/docs/10.x/artisan#command-io) for the full list of available methods.

In addition, there are some extra helpers available in the base BuildTask class that allow you to fluently format output to the console, which you will see in the examples below.

## Creating Build Tasks

### Minimal example

Here is a minimal example to give you an idea of what we are working with.

```php
class SimpleBuildTask extends PostBuildTask
{
public function handle(): void
{
//
}
}
```

As you can see, at their core, build tasks are simple classes containing a `handle()` method,
which as I'm sure you have guessed, is the method that is executed when the task is run by the build command.

If you want the task to run before the build, you would extend the `PreBuildTask` class instead.

#### Automatic output

When running the build command, you will see the following output added after the build is complete.

<pre>
<span style="color: gold">Generic build task...</span> <span style="color: gray">Done in 0.26ms</span>
</pre>

As you can see, some extra output including execution time tracking is added for us. We can of course customize all of this if we want, as you will learn a bit further down.

### Full example

Here is a full example, with all the namespaces included, as well as the most common fluent output helpers.

```php
<?php

namespace App\Actions;

use Hyde\Framework\Features\BuildTasks\PostBuildTask;

class ExampleTask extends PostBuildTask
{
public static string $message = 'Say hello';

public function handle(): void
{
$this->info('Hello World!');
}

public function printFinishMessage(): void
{
$this->line('Goodbye World!');
}
}
```

You can see a full API reference further below. But in short, the `$message` property is the message that runs before the task is executed, and the `printFinishMessage()` method is the message that runs after the task is executed.

Running this task will produce the following output:

<pre>
<small style="color: gray">$ php hyde build</small>
<span style="color: gold">Say hello...</span> <span style="color: green">Hello World!</span>
Goodbye World!
</pre>

As you can see, there is no execution time tracking here, since we overrode the `printFinishMessage()` method that normally prints this. You can of course call the `withExecutionTime()` method to add this back in. See more in the API reference below.

## Registering the Tasks

There are a few ways to register these tasks so Hyde can find them.

They are shown here in order of presumed convenience, but you are free to choose whichever you prefer. The latter options are more suited for extension developers.

### Autodiscovery registration

The easiest way to register build tasks is to not do it -- just let Hyde do it for you!

Any classes that end in `BuildTask.php` that are stored in `app/Actions` will be autoloaded and registered to run automatically.

For example: `app/Actions/ExampleBuildTask.php`.

### Config file registration

If you want, you can also register build tasks of any namespace in the convenient `build_tasks` array which is in the main configuration file, `config/hyde.php`.

```php
// filepath config/hyde.php
'build_tasks' => [
\App\Actions\SimpleTask::class,
\MyPackage\Tasks\MyBuildTask::class,
],
```

### Programmatic registration

>info This option assumes you are familiar with Laravel's service container and service providers.

If you are developing an extension, you can either instruct users register your tasks with the config option above,
or you can register the extensions programmatically, I recommend you do this in the `boot` method of a service provider.

The build tasks are registered in an internal array of the `BuildService` class, which is bound as a singleton in the underlying Laravel service container.
To actually register your task, provide the fully qualified class name of the task to the `BuildTaskService::registerTask()` method.

Here is an example of how to do this using a service provider. Though you could technically do it anywhere using the `app()` helper,
just as long as it's done early enough in the application lifecycle, so it's registered before the build command is executed.

```php
class MyServiceProvider extends ServiceProvider
{
public function boot(): void
{
$this->app->make(\Hyde\Framework\Services\BuildTaskService::class)
->registerTask(\MyPackage\Tasks\MyBuildTask::class);
}
}
```

## Error Handling

If an exception is thrown in a build task, the build command will catch it and display the error message to the user.

## Helper Methods

### Output helpers

When a build task is called by the site build command, it gets access to the Laravel and Symfony console output helpers through the `$output` property.

```php
public function handle(): void
{
/** @var \Illuminate\Console\OutputStyle $output */

$this->output->info('Hello World!');
$this->output->error('Something went wrong!');
$this->output->writeln('This is a line of text');
}
```

### Skipping tasks

>info This feature was added in HydePHP v1.6.0

If you for some reason need to skip the task during its execution, you can call the `skip()` method.

```php
public function handle(): void
{
if ($this->someCondition() !== true) {
$this->skip('Some condition was not met');

// The task will not be executed past this point
}
}
```

This will then halt the execution of the task, and display a notice with the message you provided to the console.
Loading
Loading