PHP code example of bottledcode / swytch-framework
1. Go to this page and download the library: Download bottledcode/swytch-framework 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/ */
bottledcode / swytch-framework example snippets
#[\Bottledcode\SwytchFramework\Template\Attributes\Component('example')]
class ExampleComponent {
use \Bottledcode\SwytchFramework\Template\Traits\RegularPHP;
use \Bottledcode\SwytchFramework\Template\Traits\Htmx;
#[\Bottledcode\SwytchFramework\Router\Attributes\Route(\Bottledcode\SwytchFramework\Router\Method::POST, '/api/number')]
public function getNumber(string $name, string $number): int {
return $this->render($name, random_int(0, 100));
}
public function render(string $name, int $number = null): string {
$this->begin();