1. Go to this page and download the library: Download impulsephp/core 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/ */
namespace App\Page;
use App\Layout\DefaultLayout;
use Impulse\Core\Attributes\PageProperty;
use Impulse\Core\Component\AbstractPage;
#[PageProperty(
route: '/',
name: 'home',
title: 'Accueil',
layout: DefaultLayout::class
)]
final class HomePage extends AbstractPage
{
public function template(): string
{
return <<<HTML
<h1>Accueil</h1>
HTML;
}
}
namespace App\Component;
use Impulse\Core\Attributes\Action;
use Impulse\Core\Component\AbstractComponent;
final class CounterComponent extends AbstractComponent
{
public function setup(): void
{
$this->state('count', 0);
}
#[Action]
public function increment(): void
{
$this->count++;
}
public function template(): string
{
return <<<HTML
<button>{$this->count}</button>
HTML;
}
}
use Impulse\Core\Http\Response;
return Response::redirect('/login');