1. Go to this page and download the library: Download vtapp/vtphp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vtapp / vtphp example snippets
#[Route(method: 'GET', path: '/users/{id}', name: 'users.show')]
public function show(int $id): UserResource
{
return UserResource::make($this->service->find($id));
}
echo view('emails.welcome', ['user' => $user]);
// app/Mail/WelcomeEmail.php
final class WelcomeEmail extends Mailable
{
public function __construct(private readonly User $user) {}
public function build(): void
{
$this->to($this->user->email)
->subject('Welcome to VtPhp!')
->view('emails.welcome', ['user' => $this->user]);
}
}
app(\VtPhp\Mail\Mailer::class)->send(new WelcomeEmail($user));