Frontend
Introduction
Dreamfork is a backend framework equipped with essential features for developing modern web applications, including routing, validation, file storage, and more. When it comes to frontend development in Dreamfork, the recommended approach involves utilizing PHP in conjunction with the Vision template engine.
Using PHP
In the past, the conventional approach for PHP applications involved rendering HTML to the browser using basic HTML templates interspersed with PHP echo statements, presenting data retrieved from a database during the request:
<div>
<?php foreach ($users as $user): ?>
Hello, <?php echo $user->name; ?>
<?php endforeach; ?>
</div>
With Dreamfork, a similar method for rendering HTML is still achievable, leveraging views and Vision. Vision is a lightweight and straightforward templating language that offers a concise syntax for displaying data, iterating over data, and more:
<div>
@foreach ($users as $user)
Hello, {{ $user->name }}
@endforeach
</div>
When constructing applications using this approach, form submissions and other page interactions typically result in receiving an entirely new HTML document from the server, leading to the entire page being re-rendered by the browser. Even today, many applications may find this method suitable for constructing their frontends using straightforward Vision templates.