Add practical examples showing facade alternatives to Antlers tags
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
この issue はまだ評価されていません。
説明
The current Blade documentation shows two approaches for using Statamic features in Blade:
- Antlers Blade Components (
<s:glide>) - verbose for simple use cases - Fluent tags (
Statamic::tag('glide')) - awkward syntax, not discoverable
However, there's a cleaner approach using facades that isn't documented at all.
For example: Image Manipulation (Glide), the docs currently show:
{{-- Using fluent tags --}}
<img src="{{
Statamic::tag('glide')->src('test.png')->width(1280)->height(800)->fetch() }}"
/>
{{-- Using Antlers Blade Components --}}
<s:glide src="test.png" width="1280" height="800">
<img src="{{ $url }}" />
</s:glide>
The second approach is clunky if you're just wanting the URL, so you're forced to use Statamic::tag() everywhere if you just want the data, but there's a much cleaner facade approach that isn't documented:
<img src="{{ Image::manipulate('test.png', ['w' => 1280, 'h' => 800]) }}" />
I prefer using Facades because it's more Laravel-like and familiar to developers, and also better IDE autocomplete support. It's also a cleaner syntax for simple use cases.
Suggestion
The Blade documentation should include a section showing facade equivalents for common Antlers tags. For example:
Collections:
// Instead of: Statamic::tag('collection:wheels')->limit(3)
Collection::findByHandle('wheels')->queryEntries()->limit(3)->get()
Taxonomies:
// Instead of: <s:taxonomy:categories>
Taxonomy::findByHandle('categories')
Navigation:
// Instead of: <s:nav:main>
Nav::find('main')->tree()
This would help developers transitioning from Antlers or building custom Blade components discover the most appropriate API for their needs.
- 主要言語
- PHP
- スター
- 133
- フォーク
- 405
- 平均マージ
- 21時間 45分
- マージ済み PR(30日)
- 12
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
statamic/docs のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 40/100
メンテナーはふだん 1 日以内に返信
-
Document how conditions treat empty and null values対応中かも @joshdaugherty が 10 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
Document the `query_scope` search index option対応中かも @joshdaugherty が 11 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 18/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
Spaceless tag対応中かも @marcorieser が 85 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 15/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 4 日以内に返信
-
Перевод устарел
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
bug
難易度 2/5 半日 初心者へのやさしさ 76/100
m3ue/m3u-editor#1604 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
femiwiki/docker-mediawiki#1497 ·
メンテナーはふだん 1 日以内に返信