Skip to content

Commit 5e50c5d

Browse files
committed
updated documentation
1 parent e7bbb73 commit 5e50c5d

1 file changed

Lines changed: 69 additions & 3 deletions

File tree

forge-wire.html

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ <h3 class="text-lg font-semibold mb-3">Complex Reactive Controller - Queue Manag
10191019
</div>
10201020

10211021
<h3 class="text-lg font-semibold mb-3">Standard PHP Controller</h3>
1022-
<p class="text-gray-600 mb-4">ForgeWire works with standard PHP controllers - just add attributes and islands:</p>
1022+
<p class="text-gray-600 mb-4">ForgeWire works with standard PHP controllers - no special component classes required:</p>
10231023
<div class="code-block p-6 text-white rounded-lg mb-6">
10241024
<pre><code class="language-php">#[Middleware("web")]
10251025
#[Reactive]
@@ -1073,6 +1073,21 @@ <h3 class="text-lg font-semibold mb-3">Generate Islands</h3>
10731073
forgewire:island --type=app --name=admin/dashboard --kind=page
10741074
forgewire:island --type=module --module=ForgeEvents --name=queue-stats --kind=component</code></pre>
10751075
</div>
1076+
1077+
<h3 class="text-lg font-semibold mb-3">Production Minification</h3>
1078+
<div class="code-block p-6 text-white rounded-lg mb-6">
1079+
<pre><code class="language-bash"># Generate minified production version
1080+
forgewire:minify
1081+
1082+
# Custom input/output paths
1083+
forgewire:minify --input=custom/path/forgewire.js --output=production/forgewire.min.js</code></pre>
1084+
</div>
1085+
1086+
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4">
1087+
<p class="text-sm text-blue-800">
1088+
<strong>Optimization:</strong> Removes comments, unnecessary whitespace, and optimizes JavaScript patterns for production deployment.
1089+
</p>
1090+
</div>
10761091

10771092
<h3 class="text-lg font-semibold mb-3">Generated Structure</h3>
10781093
<p class="text-gray-600 mb-4">
@@ -1124,8 +1139,59 @@ <h3 class="text-lg font-semibold mb-3">Setup Guide</h3>
11241139
<li><strong>Reactive Setup:</strong> How to add #[Reactive] and why it's required</li>
11251140
<li><strong>Action Exposure:</strong> How to use #[Action] to expose methods to browser</li>
11261141
<li><strong>State Management:</strong> How to use #[State] for property persistence</li>
1127-
<li><strong>Normal PHP:</strong> Everything else works like regular PHP - no special syntax needed</li>
1142+
<li><strong>Normal PHP:</strong> Everything else works like regular PHP</li>
11281143
</ul>
1144+
1145+
<h3 class="text-lg font-semibold mb-3">Modular Organization</h3>
1146+
<p class="text-gray-600 mb-4">
1147+
ForgeWire works with any PHP organization pattern - modules, traits, standard controllers:
1148+
</p>
1149+
<div class="code-block p-6 text-white rounded-lg mb-6">
1150+
<pre><code class="language-php">// Example from ForgeEvents module
1151+
namespace App\Modules\ForgeEvents\Controllers\Hub;
1152+
1153+
use App\Modules\ForgeEvents\Controllers\Hub\Traits\QueueJobActions;
1154+
use App\Modules\ForgeEvents\Controllers\Hub\Traits\QueueBulkActions;
1155+
use App\Modules\ForgeEvents\Services\QueueHubService;
1156+
use App\Modules\ForgeWire\Attributes\Reactive;
1157+
use App\Modules\ForgeWire\Traits\ReactiveControllerHelper;
1158+
1159+
#[Reactive]
1160+
#[Middleware('web')]
1161+
#[Middleware('auth')]
1162+
final class QueueController
1163+
{
1164+
use ControllerHelper;
1165+
use ReactiveControllerHelper;
1166+
use QueueJobActions;
1167+
use QueueBulkActions;
1168+
1169+
#[State(shared: true)]
1170+
public array $jobs = [];
1171+
1172+
#[Route("/hub/queues")]
1173+
public function index(): Response
1174+
{
1175+
// Standard PHP controller logic
1176+
$this->loadJobs();
1177+
return $this->view("pages/hub/queues", [
1178+
'jobs' => $this->jobs,
1179+
// All other data passed explicitly
1180+
]);
1181+
}
1182+
1183+
#[Action]
1184+
public function bulkDelete(): void
1185+
{
1186+
// Standard method implementation
1187+
foreach ($this->selectedJobs as $jobId) {
1188+
$this->queueService->deleteJob($jobId);
1189+
}
1190+
$this->selectedJobs = [];
1191+
$this->loadJobs();
1192+
}
1193+
}</code></pre>
1194+
</div>
11291195
</section>
11301196

11311197
<!-- Suggestions -->
@@ -1159,7 +1225,7 @@ <h3 class="font-semibold text-lg mb-3 text-orange-600">Things to Consider</h3>
11591225
<li>• Consider session size with large state objects</li>
11601226
<li>• Don't forget #[Action] on callable methods</li>
11611227
<li>• Polling frequency affects performance</li>
1162-
<li>• Mixing reactive and non-reactive controllers can get confusing</li>
1228+
11631229
<li>• Security matters with shared state</li>
11641230
<li>• Validation helps catch issues early</li>
11651231
<li>• CLI generators save time and provide structure</li>

0 commit comments

Comments
 (0)