1. Go to this page and download the library: Download waffle-commons/skeleton 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/ */
waffle-commons / skeleton example snippets
namespace App\Service;
readonly class Greeter
{
public function sayHello(string $name): string
{
return "Welcome to Waffle, {$name}!";
}
}
namespace App\Controller;
use App\Service\Greeter;
use Psr\Http\Message\ResponseInterface;
use Waffle\Commons\Contracts\Routing\Attribute\Route;
use Waffle\Commons\Contracts\Security\Attribute\PublicAccess;
use Waffle\Core\BaseController;
class HelloController extends BaseController
{
// Services are automatically injected (Autowiring)
public function __construct(
private Greeter $greeter
) {}
// `methods` is a LIST, and it is optional (defaults to ['GET']).
// `#[PublicAccess]` is