PHP code example of webcartell / anvil

1. Go to this page and download the library: Download webcartell/anvil 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/ */

    

webcartell / anvil example snippets


use App\Containers\Vendor\Anvil\Parents\Mail;

class WelcomeEmail extends Mail
{
    protected string $templateName = 'welcome_email';

    public function variables(): array
    {
        return [
            'user' => [
            'name' => 'John Doe'
            ]
        ];
    }

use App\Containers\Vendor\Anvil\Models\Webhook;

// Register a webhook
Webhook::create([
    'event' => 'user.created',
    'url' => 'https://your-endpoint.com/webhook',
    'secret_key' => 'your-secret'
]);

use App\Containers\Vendor\Anvil\Parents\AnvilController;

class UserController extends AnvilController
{
    public bool $dispatchesEvent = true;
    public bool $triggersWebhooks = true;
}
bash
php composer 
bash
php artisan migrate