forked from mirrors/flight-core
Compare commits
30 Commits
master
...
580-view-c
| Author | SHA1 | Date |
|---|---|---|
|
|
48035d6a92 | 5 months ago |
|
|
dd238319da | 5 months ago |
|
|
8c277dadd6 | 5 months ago |
|
|
7acf6c00b9 | 5 months ago |
|
|
8c88b9d94a | 5 months ago |
|
|
52ec6b8803 | 5 months ago |
|
|
5076b266b3 | 5 months ago |
|
|
5c4b9b9856 | 5 months ago |
|
|
8280d4ddaf | 5 months ago |
|
|
5cdc2e85c0 | 5 months ago |
|
|
38d4458e96 | 5 months ago |
|
|
538c9d32ae | 5 months ago |
|
|
bc86e7a298 | 5 months ago |
|
|
50c23de325 | 5 months ago |
|
|
a94431ae05 | 5 months ago |
|
|
576801967c | 5 months ago |
|
|
a6dbd321ae | 5 months ago |
|
|
6afd221c76 | 5 months ago |
|
|
ee9699e8ad | 5 months ago |
|
|
b1c56b1a6e | 5 months ago |
|
|
6b506636f0 | 5 months ago |
|
|
abdf845899 | 5 months ago |
|
|
2321b0e079 | 5 months ago |
|
|
206eff4f3d | 5 months ago |
|
|
d28939f204 | 5 months ago |
|
|
7d29fdf719 | 5 months ago |
|
|
f047d22fab | 5 months ago |
|
|
98e20c6ad1 | 5 months ago |
|
|
a3423b4cdf | 5 months ago |
|
|
cd2072e409 | 5 months ago |
@ -0,0 +1,27 @@
|
||||
# FlightPHP/Core Project Instructions
|
||||
|
||||
## Overview
|
||||
This is the main FlightPHP core library for building fast, simple, and extensible PHP web applications. It is dependency-free for core usage and supports PHP 7.4+.
|
||||
|
||||
## Project Guidelines
|
||||
- PHP 7.4 must be supported. PHP 8 or greater also supported, but avoid PHP 8+ only features.
|
||||
- Keep the core library dependency-free (no polyfills or interface-only repositories).
|
||||
- All Flight projects are meant to be kept simple and fast. Performance is a priority.
|
||||
- Flight is extensible and when implementing new features, consider how they can be added as plugins or extensions rather than bloating the core library.
|
||||
- Any new features built into the core should be well-documented and tested.
|
||||
- Any new features should be added with a focus on simplicity and performance, avoiding unnecessary complexity.
|
||||
- This is not a Laravel, Yii, Code Igniter or Symfony clone. It is a simple, fast, and extensible framework that allows you to build applications quickly without the overhead of large frameworks.
|
||||
|
||||
## Development & Testing
|
||||
- Run tests: `composer test` (uses phpunit/phpunit and spatie/phpunit-watcher)
|
||||
- Run test server: `composer test-server` or `composer test-server-v2`
|
||||
- Lint code: `composer lint` (uses phpstan/phpstan, level 6)
|
||||
- Beautify code: `composer beautify` (uses squizlabs/php_codesniffer, PSR1)
|
||||
- Check code style: `composer phpcs`
|
||||
- Test coverage: `composer test-coverage`
|
||||
|
||||
## Coding Standards
|
||||
- Follow PSR1 coding standards (enforced by PHPCS)
|
||||
- Use strict comparisons (`===`, `!==`)
|
||||
- PHPStan level 6 compliance
|
||||
- Focus on PHP 7.4 compatibility (avoid PHP 8+ only features)
|
||||
@ -0,0 +1,13 @@
|
||||
/.gemini export-ignore
|
||||
/.github export-ignore
|
||||
/tests export-ignore
|
||||
/.editorconfig export-ignore
|
||||
/.gitattributes export-ignore
|
||||
/.gitignore export-ignore
|
||||
/CONTRIBUTING.md export-ignore
|
||||
/index.php export-ignore
|
||||
/phpcs.xml.dist export-ignore
|
||||
/phpstan-baseline.neon export-ignore
|
||||
/phpstan.dist.neon export-ignore
|
||||
/phpunit-watcher.yml export-ignore
|
||||
/phpunit.xml.dist export-ignore
|
||||
@ -1,18 +1,15 @@
|
||||
*.sublime-*
|
||||
.DS_Store
|
||||
.idea/
|
||||
.vscode/
|
||||
vendor/
|
||||
composer.phar
|
||||
composer.lock
|
||||
.phpunit.result.cache
|
||||
.runway-config.json
|
||||
.runway-creds.json
|
||||
/.idea
|
||||
/.vscode
|
||||
/coverage
|
||||
/vendor
|
||||
coverage/
|
||||
*.sublime*
|
||||
clover.xml
|
||||
composer.lock
|
||||
composer.phar
|
||||
phpcs.xml
|
||||
phpstan.neon
|
||||
phpunit.xml
|
||||
.runway-config.json
|
||||
.runway-creds.json
|
||||
.phpunit-watcher.yml
|
||||
.DS_Store
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| > 3.18.0 | :white_check_mark: |
|
||||
| <= 2.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Use Github to securely report the vulnerability.
|
||||
@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace flight\commands;
|
||||
|
||||
/**
|
||||
* @property-read ?string $configFile
|
||||
* @property-read ?string $baseDir
|
||||
*/
|
||||
class AiGenerateInstructionsCommand extends AbstractBaseCommand
|
||||
{
|
||||
/**
|
||||
* Constructor for the AiGenerateInstructionsCommand class.
|
||||
*
|
||||
* Initializes a new instance of the command.
|
||||
*
|
||||
* @param array<string,mixed> $config Config from config.php
|
||||
*/
|
||||
public function __construct(array $config)
|
||||
{
|
||||
parent::__construct('ai:generate-instructions', 'Generate project-specific AI coding instructions', $config);
|
||||
|
||||
$this->option(
|
||||
'--config-file',
|
||||
'Path to .runway-config.json file (deprecated, use config.php instead)',
|
||||
null,
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the command logic for generating AI instructions.
|
||||
*
|
||||
* This method is called to perform the main functionality of the
|
||||
* AiGenerateInstructionsCommand. It should contain the steps required
|
||||
* to generate and output instructions using AI, based on the command's
|
||||
* configuration and input.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function execute(): int
|
||||
{
|
||||
$io = $this->app()->io();
|
||||
|
||||
if (empty($this->config['runway'])) {
|
||||
$configFile = $this->configFile;
|
||||
$io = $this->app()->io();
|
||||
|
||||
$io->warn(
|
||||
'The --config-file option is deprecated. '
|
||||
. 'Move your config values to the \'runway\' key in the config.php file for configuration.',
|
||||
true
|
||||
);
|
||||
$runwayConfig = json_decode(file_get_contents($configFile), true) ?? [];
|
||||
} else {
|
||||
$runwayConfig = $this->config['runway'];
|
||||
}
|
||||
|
||||
// Check for runway creds ai
|
||||
if (empty($runwayConfig['ai'])) {
|
||||
$io->error('Missing AI configuration. Please run the \'ai:init\' command first.', true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
$io->info('Let\'s gather some project details to generate AI coding instructions.', true);
|
||||
|
||||
// Ask questions
|
||||
$projectDesc = $io->prompt('Please describe what your project is for?');
|
||||
|
||||
$database = $io->prompt(
|
||||
'What database are you planning on using? (e.g. MySQL, SQLite, PostgreSQL, none)',
|
||||
'none'
|
||||
);
|
||||
|
||||
$templating = $io->prompt(
|
||||
'What HTML templating engine will you plan on using (if any)? (recommend latte)',
|
||||
'latte'
|
||||
);
|
||||
|
||||
$security = $io->confirm('Is security an important element of this project?', 'y');
|
||||
$performance = $io->confirm('Is performance and speed an important part of this project?', 'y');
|
||||
|
||||
$composerLibs = $io->prompt(
|
||||
'What major composer libraries will you be using if you know them right now?',
|
||||
'none'
|
||||
);
|
||||
|
||||
$envSetup = $io->prompt(
|
||||
'How will you set up your development environment? (e.g. Docker, Vagrant, PHP dev server, other)',
|
||||
'Docker'
|
||||
);
|
||||
|
||||
$teamSize = $io->prompt('How many developers will be working on this project?', '1');
|
||||
$api = $io->confirm('Will this project expose an API?', 'n');
|
||||
$other = $io->prompt('Any other important requirements or context? (optional)', 'no');
|
||||
|
||||
// Prepare prompt for LLM
|
||||
$contextFile = $this->projectRoot . '.github/copilot-instructions.md';
|
||||
$context = file_exists($contextFile) === true ? file_get_contents($contextFile) : '';
|
||||
$userDetails = [
|
||||
'Project Description' => $projectDesc,
|
||||
'Database' => $database,
|
||||
'Templating Engine' => $templating,
|
||||
'Security Important' => $security ? 'yes' : 'no',
|
||||
'Performance Important' => $performance ? 'yes' : 'no',
|
||||
'Composer Libraries' => $composerLibs,
|
||||
'Environment Setup' => $envSetup,
|
||||
'Team Size' => $teamSize,
|
||||
'API' => $api ? 'yes' : 'no',
|
||||
'Other' => $other,
|
||||
];
|
||||
$detailsText = "";
|
||||
foreach ($userDetails as $k => $v) {
|
||||
$detailsText .= "$k: $v\n";
|
||||
}
|
||||
$prompt = <<<EOT
|
||||
You are an AI coding assistant. Update the following project instructions for this Flight PHP project based on the latest user answers. Only output the new instructions, no extra commentary.
|
||||
User answers:
|
||||
$detailsText
|
||||
Current instructions:
|
||||
$context
|
||||
EOT; // phpcs:ignore
|
||||
|
||||
// Read LLM creds
|
||||
$creds = $runwayConfig['ai'];
|
||||
$apiKey = $creds['api_key'];
|
||||
$model = $creds['model'];
|
||||
$baseUrl = $creds['base_url'];
|
||||
|
||||
// Prepare curl call (OpenAI compatible)
|
||||
$headers = [
|
||||
'Content-Type: application/json',
|
||||
'Authorization: Bearer ' . $apiKey,
|
||||
];
|
||||
$data = [
|
||||
'model' => $model,
|
||||
'messages' => [
|
||||
[
|
||||
'role' => 'system',
|
||||
'content' => 'You are a helpful AI coding assistant focused on the Flight Framework for PHP. '
|
||||
. 'You are up to date with all your knowledge from https://docs.flightphp.com. '
|
||||
. 'As an expert into the programming language PHP, '
|
||||
. 'you are top notch at architecting out proper instructions for FlightPHP projects.'
|
||||
],
|
||||
['role' => 'user', 'content' => $prompt],
|
||||
],
|
||||
'temperature' => 0.2,
|
||||
];
|
||||
$jsonData = json_encode($data);
|
||||
|
||||
// add info line that this may take a few minutes
|
||||
$io->info('Generating AI instructions, this may take a few minutes...', true);
|
||||
|
||||
$result = $this->callLlmApi($baseUrl, $headers, $jsonData, $io);
|
||||
if ($result === false) {
|
||||
return 1;
|
||||
}
|
||||
$response = json_decode($result, true);
|
||||
$instructions = $response['choices'][0]['message']['content'] ?? '';
|
||||
if (!$instructions) {
|
||||
$io->error('No instructions returned from LLM.', true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Write to files
|
||||
$io->info(
|
||||
'Updating .github/copilot-instructions.md, '
|
||||
. '.cursor/rules/project-overview.mdc, '
|
||||
. '.gemini/GEMINI.md and .windsurfrules...',
|
||||
true
|
||||
);
|
||||
|
||||
if (!is_dir($this->projectRoot . '.github')) {
|
||||
mkdir($this->projectRoot . '.github', 0755, true);
|
||||
}
|
||||
if (!is_dir($this->projectRoot . '.cursor/rules')) {
|
||||
mkdir($this->projectRoot . '.cursor/rules', 0755, true);
|
||||
}
|
||||
if (!is_dir($this->projectRoot . '.gemini')) {
|
||||
mkdir($this->projectRoot . '.gemini', 0755, true);
|
||||
}
|
||||
file_put_contents($this->projectRoot . '.github/copilot-instructions.md', $instructions);
|
||||
file_put_contents($this->projectRoot . '.cursor/rules/project-overview.mdc', $instructions);
|
||||
file_put_contents($this->projectRoot . '.gemini/GEMINI.md', $instructions);
|
||||
file_put_contents($this->projectRoot . '.windsurfrules', $instructions);
|
||||
$io->ok('AI instructions updated successfully.', true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the LLM API call using curl
|
||||
*
|
||||
* @param string $baseUrl
|
||||
* @param array<int,string> $headers
|
||||
* @param string $jsonData
|
||||
* @param object $io
|
||||
*
|
||||
* @return string|false
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function callLlmApi($baseUrl, $headers, $jsonData, $io)
|
||||
{
|
||||
$ch = curl_init($baseUrl . '/v1/chat/completions');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) {
|
||||
$io->error('Failed to call LLM API: ' . curl_error($ch), true);
|
||||
curl_close($ch);
|
||||
return false;
|
||||
}
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace flight\commands;
|
||||
|
||||
/**
|
||||
* @property-read ?string $credsFile Deprecated, use config.php instead
|
||||
*/
|
||||
class AiInitCommand extends AbstractBaseCommand
|
||||
{
|
||||
/**
|
||||
* Constructor for the AiInitCommand class.
|
||||
*
|
||||
* Initializes the command instance and sets up any required dependencies.
|
||||
*
|
||||
* @param array<string,mixed> $config Config from config.php
|
||||
*/
|
||||
public function __construct(array $config)
|
||||
{
|
||||
parent::__construct('ai:init', 'Initialize LLM API credentials and settings', $config);
|
||||
$this->option('--creds-file', 'Path to .runway-creds.json file (deprecated, use config.php instead)', null, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the function
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function execute(): int
|
||||
{
|
||||
$io = $this->app()->io();
|
||||
|
||||
$io->info('Welcome to AI Init!', true);
|
||||
|
||||
// Prompt for API provider with validation
|
||||
$allowedApis = [
|
||||
'1' => 'openai',
|
||||
'2' => 'grok',
|
||||
'3' => 'claude'
|
||||
];
|
||||
$apiChoice = strtolower(trim($io->choice('Which LLM API do you want to use?', $allowedApis, '1')));
|
||||
$api = $allowedApis[$apiChoice] ?? 'openai';
|
||||
|
||||
// Prompt for base URL with validation
|
||||
switch ($api) {
|
||||
case 'openai':
|
||||
$defaultBaseUrl = 'https://api.openai.com';
|
||||
break;
|
||||
case 'grok':
|
||||
$defaultBaseUrl = 'https://api.x.ai';
|
||||
break;
|
||||
case 'claude':
|
||||
$defaultBaseUrl = 'https://api.anthropic.com';
|
||||
break;
|
||||
}
|
||||
$baseUrl = trim($io->prompt('Enter the base URL for the LLM API', $defaultBaseUrl));
|
||||
if (empty($baseUrl) || !filter_var($baseUrl, FILTER_VALIDATE_URL)) {
|
||||
$io->error('Base URL cannot be empty and must be a valid URL.', true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Validate API key input
|
||||
$apiKey = trim($io->prompt('Enter your API key for ' . $api));
|
||||
if (empty($apiKey)) {
|
||||
$io->error('API key cannot be empty. Please enter a valid API key.', true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Validate model input
|
||||
switch ($api) {
|
||||
case 'openai':
|
||||
$defaultModel = 'gpt-5';
|
||||
break;
|
||||
case 'grok':
|
||||
$defaultModel = 'grok-4.1-fast-non-reasoning';
|
||||
break;
|
||||
case 'claude':
|
||||
$defaultModel = 'claude-sonnet-4-5';
|
||||
break;
|
||||
}
|
||||
|
||||
$model = trim($io->prompt(
|
||||
'Enter the model name you want to use (e.g. gpt-5, claude-sonnet-4-5, etc)',
|
||||
$defaultModel
|
||||
));
|
||||
|
||||
$runwayAiConfig = [
|
||||
'provider' => $api,
|
||||
'api_key' => $apiKey,
|
||||
'model' => $model,
|
||||
'base_url' => $baseUrl,
|
||||
];
|
||||
$this->setRunwayConfigValue('ai', $runwayAiConfig);
|
||||
|
||||
$io->ok('Credentials saved to app/config/config.php', true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace flight\core;
|
||||
|
||||
use Closure;
|
||||
use ReflectionFunction;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* @template CallableWithoutFilters of Closure = Closure
|
||||
* @template Output = mixed
|
||||
*/
|
||||
final class FilteredCallable
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var CallableWithoutFilters
|
||||
*/
|
||||
private $closure;
|
||||
|
||||
/** @var (callable(mixed[] &$input): (void|never|false))[] */
|
||||
private array $beforeFilters = [];
|
||||
|
||||
/** @var (callable(mixed &$output): (void|never|false))[] */
|
||||
private array $afterFilters = [];
|
||||
|
||||
/** @param CallableWithoutFilters|callable(): Output $callable */
|
||||
public function __construct(callable $callable)
|
||||
{
|
||||
$this->closure = Closure::fromCallable($callable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed ...$input
|
||||
* @return Output
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function __invoke(...$input)
|
||||
{
|
||||
foreach ($this->beforeFilters as $filter) {
|
||||
$filterReturnValue = $filter($input);
|
||||
|
||||
if ($filterReturnValue === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$closure = $this->closure;
|
||||
|
||||
$output = $closure(...$input);
|
||||
|
||||
foreach ($this->afterFilters as $filter) {
|
||||
$filterReturnValue = $filter($output);
|
||||
|
||||
if ($filterReturnValue === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/** @param callable(mixed[] &$input): (void|never|false) $filter */
|
||||
public function pushBeforeFilter(callable $filter): void
|
||||
{
|
||||
if (!in_array($filter, $this->beforeFilters)) {
|
||||
$this->beforeFilters[] = $filter;
|
||||
}
|
||||
}
|
||||
|
||||
/** @param callable(Output &$output): (void|never|false) $filter */
|
||||
public function pushAfterFilter(callable $filter): void
|
||||
{
|
||||
if (!in_array($filter, $this->afterFilters)) {
|
||||
$filterReflectionFunction = new ReflectionFunction($filter);
|
||||
|
||||
if ($filterReflectionFunction->getNumberOfParameters() === 2) {
|
||||
$filter = static function (&$output) use ($filter) {
|
||||
static $input = [];
|
||||
|
||||
return $filter($input, $output);
|
||||
};
|
||||
}
|
||||
|
||||
$this->afterFilters[] = $filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace flight\template;
|
||||
|
||||
abstract class Component
|
||||
{
|
||||
abstract public function html(): string;
|
||||
|
||||
public function css(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function js(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
parameters:
|
||||
ignoreErrors: []
|
||||
@ -1,13 +1,13 @@
|
||||
hideManual: true
|
||||
notifications:
|
||||
failingTests: false
|
||||
passingTests: false
|
||||
phpunit:
|
||||
arguments: '--stop-on-failure'
|
||||
binaryPath: ./vendor/bin/phpunit
|
||||
timeout: 180
|
||||
watch:
|
||||
directories:
|
||||
- tests
|
||||
- flight
|
||||
fileMask: '*.php'
|
||||
notifications:
|
||||
passingTests: false
|
||||
failingTests: false
|
||||
phpunit:
|
||||
binaryPath: ./vendor/bin/phpunit
|
||||
arguments: '--stop-on-failure'
|
||||
timeout: 180
|
||||
|
||||
@ -0,0 +1 @@
|
||||
my-component-from-another-path
|
||||
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\middleware;
|
||||
|
||||
class Something
|
||||
{
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$path = file_exists(__DIR__ . '/../vendor/autoload.php')
|
||||
? __DIR__ . '/../vendor/autoload.php'
|
||||
: __DIR__ . '/../flight/autoload.php';
|
||||
|
||||
require_once($path);
|
||||
@ -0,0 +1,243 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This is the test file where we can open up a quick test server and make
|
||||
* sure that the UI is really working the way we would expect it to.
|
||||
*
|
||||
* @author Kristaps Muižnieks https://github.com/krmu
|
||||
*/
|
||||
|
||||
namespace Tests\ServerV2 {
|
||||
class AuthCheck
|
||||
{
|
||||
public function before(): void
|
||||
{
|
||||
if (!isset($_COOKIE['user'])) {
|
||||
echo '<span id="infotext">Middleware text:</span> You are not authorized to access this route!';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
use Tests\ServerV2\AuthCheck;
|
||||
|
||||
require_once __DIR__ . '/../phpunit_autoload.php';
|
||||
|
||||
Flight::set('flight.content_length', false);
|
||||
Flight::set('flight.views.path', './');
|
||||
Flight::set('flight.views.extension', '.phtml');
|
||||
// This enables the old functionality of Flight output buffering
|
||||
Flight::set('flight.v2.output_buffering', true);
|
||||
|
||||
// Test 1: Root route
|
||||
Flight::route('/', function () {
|
||||
echo '<span id="infotext">Route text:</span> Root route works!';
|
||||
|
||||
if (Flight::request()->query['redirected']) {
|
||||
echo '<br>Redirected from /redirect route successfully!';
|
||||
}
|
||||
});
|
||||
|
||||
Flight::route('/querytestpath', function () {
|
||||
echo '<span id="infotext">Route text:</span> This ir query route<br>';
|
||||
echo 'I got such query parameters:<pre>';
|
||||
print_r(Flight::request()->query);
|
||||
echo '</pre>';
|
||||
}, false, 'querytestpath');
|
||||
|
||||
// Test 2: Simple route
|
||||
Flight::route('/test', function () {
|
||||
echo '<span id="infotext">Route text:</span> Test route works!';
|
||||
});
|
||||
|
||||
// Test 3: Route with parameter
|
||||
Flight::route('/user/@name', function ($name) {
|
||||
echo "<span id='infotext'>Route text:</span> Hello, $name!";
|
||||
});
|
||||
|
||||
Flight::route('POST /postpage', function () {
|
||||
echo '<span id="infotext">Route text:</span> THIS IS POST METHOD PAGE';
|
||||
}, false, 'postpage');
|
||||
|
||||
// Test 4: Grouped routes
|
||||
Flight::group('/group', function () {
|
||||
Flight::route('/test', function () {
|
||||
echo '<span id="infotext">Route text:</span> Group test route works!';
|
||||
});
|
||||
|
||||
Flight::route('/user/@name', function ($name) {
|
||||
echo "<span id='infotext'>Route text:</span> There is variable called name and it is $name";
|
||||
});
|
||||
|
||||
Flight::group('/group1', function () {
|
||||
Flight::group('/group2', function () {
|
||||
Flight::group('/group3', function () {
|
||||
Flight::group('/group4', function () {
|
||||
Flight::group('/group5', function () {
|
||||
Flight::group('/group6', function () {
|
||||
Flight::group('/group7', function () {
|
||||
Flight::group('/group8', function () {
|
||||
Flight::route('/final_group', function () {
|
||||
echo 'Mega Group test route works!';
|
||||
}, false, 'final_group');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Test 5: Route alias
|
||||
Flight::route('/alias', function () {
|
||||
echo '<span id="infotext">Route text:</span> Alias route works!';
|
||||
}, false, 'aliasroute');
|
||||
|
||||
$middle = new AuthCheck();
|
||||
|
||||
// Test 6: Route with middleware
|
||||
Flight::route('/protected', function () {
|
||||
echo '<span id="infotext">Route text:</span> Protected route works!';
|
||||
})->addMiddleware([$middle]);
|
||||
|
||||
// Test 7: Route with template
|
||||
Flight::route('/template/@name', function ($name) {
|
||||
Flight::render('template.phtml', ['name' => $name]);
|
||||
});
|
||||
|
||||
// Test 8: Throw an error
|
||||
Flight::route('/error', function () {
|
||||
trigger_error('This is a successful error');
|
||||
});
|
||||
|
||||
// Test 9: JSON output (should not output any other html)
|
||||
Flight::route('/json', function () {
|
||||
echo "\n\n\n\n\n";
|
||||
Flight::json(['message' => 'JSON renders successfully!']);
|
||||
echo "\n\n\n\n\n";
|
||||
});
|
||||
|
||||
// Test 13: JSONP output (should not output any other html)
|
||||
Flight::route('/jsonp', function () {
|
||||
echo "\n\n\n\n\n";
|
||||
Flight::jsonp(['message' => 'JSONP renders successfully!'], 'jsonp');
|
||||
echo "\n\n\n\n\n";
|
||||
});
|
||||
|
||||
Flight::route('/json-halt', function () {
|
||||
Flight::jsonHalt(['message' => 'JSON rendered and halted successfully with no other body content!']);
|
||||
});
|
||||
|
||||
// Test 10: Halt
|
||||
Flight::route('/halt', function () {
|
||||
Flight::halt(400, 'Halt worked successfully');
|
||||
});
|
||||
|
||||
// Test 11: Redirect
|
||||
Flight::route('/redirect', function () {
|
||||
Flight::redirect('/?redirected=1');
|
||||
});
|
||||
|
||||
Flight::set('flight.views.path', './');
|
||||
|
||||
Flight::map('error', function (Throwable $error) {
|
||||
echo "<h1> An error occurred, mapped error method worked, error below </h1>";
|
||||
echo '<pre style="border: 2px solid red; padding: 21px; background: lightgray; font-weight: bold;">';
|
||||
echo str_replace(getenv('PWD'), "***CLASSIFIED*****", $error->getTraceAsString());
|
||||
echo "</pre>";
|
||||
echo "<a href='/'>Go back</a>";
|
||||
});
|
||||
|
||||
Flight::map('notFound', function () {
|
||||
echo '<span id="infotext">Route text:</span> The requested URL was not found';
|
||||
echo "<a href='/'>Go back</a>";
|
||||
});
|
||||
|
||||
echo '
|
||||
<style>
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
li {
|
||||
float: left;
|
||||
}
|
||||
#infotext {
|
||||
font-weight: bold;
|
||||
color: blueviolet;
|
||||
}
|
||||
li a {
|
||||
display: block;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
li a:hover {
|
||||
background-color: #111;
|
||||
}
|
||||
#container {
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
margin: 20px 0;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
#debugrequest {
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
margin: 20px 0;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
<ul>
|
||||
<li><a href="/">Root Route</a></li>
|
||||
<li><a href="/test">Test Route</a></li>
|
||||
<li><a href="/user/John">User Route with Parameter (John)</a></li>
|
||||
<li><a href="/group/test">Grouped Test Route</a></li>
|
||||
<li><a href="/group/user/Jane">Grouped User Route with Parameter (Jane)</a></li>
|
||||
<li><a href="/alias">Alias Route</a></li>
|
||||
<li><a href="/protected">Protected path</a></li>
|
||||
<li><a href="/template/templatevariable">Template path</a></li>
|
||||
<li><a href="/querytestpath?test=1&variable2=uuid&variable3=tester">Query path</a></li>
|
||||
<li><a href="/postpage">Post method test page - should be 404</a></li>
|
||||
<li><a href="' . Flight::getUrl('final_group') . '">Mega group</a></li>
|
||||
<li><a href="/error">Error</a></li>
|
||||
<li><a href="/json">JSON</a></li>
|
||||
<li><a href="/jsonp?jsonp=myjson">JSONP</a></li>
|
||||
<li><a href="/json-halt">JSON Halt</a></li>
|
||||
<li><a href="/halt">Halt</a></li>
|
||||
<li><a href="/redirect">Redirect</a></li>
|
||||
</ul>';
|
||||
|
||||
Flight::before('start', function () {
|
||||
echo '<div id="container">';
|
||||
});
|
||||
|
||||
Flight::after('start', function () {
|
||||
echo '</div>';
|
||||
echo '<div id="debugrequest">';
|
||||
echo "Request information<pre>";
|
||||
print_r(Flight::request());
|
||||
echo "</pre>";
|
||||
echo "</div>";
|
||||
});
|
||||
|
||||
Flight::start();
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace tests\server_v2;
|
||||
|
||||
class AuthCheck
|
||||
{
|
||||
public function before(): void
|
||||
{
|
||||
if (!isset($_COOKIE['user'])) {
|
||||
echo '<span id="infotext">Middleware text:</span> You are not authorized to access this route!';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,228 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use tests\server_v2\AuthCheck;
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
/*
|
||||
* This is the test file where we can open up a quick test server and make
|
||||
* sure that the UI is really working the way we would expect it to.
|
||||
*
|
||||
* @author Kristaps Muižnieks https://github.com/krmu
|
||||
*/
|
||||
|
||||
Flight::set('flight.content_length', false);
|
||||
Flight::set('flight.views.path', './');
|
||||
Flight::set('flight.views.extension', '.phtml');
|
||||
// This enables the old functionality of Flight output buffering
|
||||
Flight::set('flight.v2.output_buffering', true);
|
||||
|
||||
// Test 1: Root route
|
||||
Flight::route('/', function () {
|
||||
echo '<span id="infotext">Route text:</span> Root route works!';
|
||||
|
||||
if (Flight::request()->query['redirected']) {
|
||||
echo '<br>Redirected from /redirect route successfully!';
|
||||
}
|
||||
});
|
||||
|
||||
Flight::route('/querytestpath', function () {
|
||||
echo '<span id="infotext">Route text:</span> This is query route<br>';
|
||||
echo 'I got such query parameters:<pre>';
|
||||
print_r(Flight::request()->query);
|
||||
echo '</pre>';
|
||||
}, false, 'querytestpath');
|
||||
|
||||
// Test 2: Simple route
|
||||
Flight::route('/test', function () {
|
||||
echo '<span id="infotext">Route text:</span> Test route works!';
|
||||
});
|
||||
|
||||
// Test 3: Route with parameter
|
||||
Flight::route('/user/@name', function ($name) {
|
||||
echo "<span id='infotext'>Route text:</span> Hello, $name!";
|
||||
});
|
||||
|
||||
Flight::route('POST /postpage', function () {
|
||||
echo '<span id="infotext">Route text:</span> THIS IS POST METHOD PAGE';
|
||||
}, false, 'postpage');
|
||||
|
||||
// Test 4: Grouped routes
|
||||
Flight::group('/group', function () {
|
||||
Flight::route('/test', function () {
|
||||
echo '<span id="infotext">Route text:</span> Group test route works!';
|
||||
});
|
||||
|
||||
Flight::route('/user/@name', function ($name) {
|
||||
echo "<span id='infotext'>Route text:</span> There is variable called name and it is $name";
|
||||
});
|
||||
|
||||
Flight::group('/group1', function () {
|
||||
Flight::group('/group2', function () {
|
||||
Flight::group('/group3', function () {
|
||||
Flight::group('/group4', function () {
|
||||
Flight::group('/group5', function () {
|
||||
Flight::group('/group6', function () {
|
||||
Flight::group('/group7', function () {
|
||||
Flight::group('/group8', function () {
|
||||
Flight::route('/final_group', function () {
|
||||
echo 'Mega Group test route works!';
|
||||
}, false, 'final_group');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Test 5: Route alias
|
||||
Flight::route('/alias', function () {
|
||||
echo '<span id="infotext">Route text:</span> Alias route works!';
|
||||
}, false, 'aliasroute');
|
||||
|
||||
$middle = new AuthCheck();
|
||||
|
||||
// Test 6: Route with middleware
|
||||
Flight::route('/protected', function () {
|
||||
echo '<span id="infotext">Route text:</span> Protected route works!';
|
||||
})->addMiddleware([$middle]);
|
||||
|
||||
// Test 7: Route with template
|
||||
Flight::route('/template/@name', function ($name) {
|
||||
Flight::render('template.phtml', ['name' => $name]);
|
||||
});
|
||||
|
||||
// Test 8: Throw an error
|
||||
Flight::route('/error', function () {
|
||||
trigger_error('This is a successful error');
|
||||
});
|
||||
|
||||
// Test 9: JSON output (should not output any other html)
|
||||
Flight::route('/json', function () {
|
||||
echo "\n\n\n\n\n";
|
||||
Flight::json(['message' => 'JSON renders successfully!']);
|
||||
echo "\n\n\n\n\n";
|
||||
});
|
||||
|
||||
// Test 13: JSONP output (should not output any other html)
|
||||
Flight::route('/jsonp', function () {
|
||||
echo "\n\n\n\n\n";
|
||||
Flight::jsonp(['message' => 'JSONP renders successfully!'], 'jsonp');
|
||||
echo "\n\n\n\n\n";
|
||||
});
|
||||
|
||||
Flight::route('/json-halt', function () {
|
||||
Flight::jsonHalt(['message' => 'JSON rendered and halted successfully with no other body content!']);
|
||||
});
|
||||
|
||||
// Test 10: Halt
|
||||
Flight::route('/halt', function () {
|
||||
Flight::halt(400, 'Halt worked successfully');
|
||||
});
|
||||
|
||||
// Test 11: Redirect
|
||||
Flight::route('/redirect', function () {
|
||||
Flight::redirect('/?redirected=1');
|
||||
});
|
||||
|
||||
Flight::set('flight.views.path', './');
|
||||
|
||||
Flight::map('error', function (Throwable $error) {
|
||||
echo "<h1> An error occurred, mapped error method worked, error below </h1>";
|
||||
echo '<pre style="border: 2px solid red; padding: 21px; background: lightgray; font-weight: bold;">';
|
||||
echo str_replace(getenv('PWD'), "***CLASSIFIED*****", $error->getTraceAsString());
|
||||
echo "</pre>";
|
||||
echo "<a href='/'>Go back</a>";
|
||||
});
|
||||
|
||||
Flight::map('notFound', function () {
|
||||
echo '<span id="infotext">Route text:</span> The requested URL was not found';
|
||||
echo "<a href='/'>Go back</a>";
|
||||
});
|
||||
|
||||
echo '
|
||||
<style>
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
li {
|
||||
float: left;
|
||||
}
|
||||
#infotext {
|
||||
font-weight: bold;
|
||||
color: blueviolet;
|
||||
}
|
||||
li a {
|
||||
display: block;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
li a:hover {
|
||||
background-color: #111;
|
||||
}
|
||||
#container {
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
margin: 20px 0;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
#debugrequest {
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
margin: 20px 0;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
<ul>
|
||||
<li><a href="/">Root Route</a></li>
|
||||
<li><a href="/test">Test Route</a></li>
|
||||
<li><a href="/user/John">User Route with Parameter (John)</a></li>
|
||||
<li><a href="/group/test">Grouped Test Route</a></li>
|
||||
<li><a href="/group/user/Jane">Grouped User Route with Parameter (Jane)</a></li>
|
||||
<li><a href="/alias">Alias Route</a></li>
|
||||
<li><a href="/protected">Protected path</a></li>
|
||||
<li><a href="/template/templatevariable">Template path</a></li>
|
||||
<li><a href="/querytestpath?test=1&variable2=uuid&variable3=tester">Query path</a></li>
|
||||
<li><a href="/postpage">Post method test page - should be 404</a></li>
|
||||
<li><a href="' . Flight::getUrl('final_group') . '">Mega group</a></li>
|
||||
<li><a href="/error">Error</a></li>
|
||||
<li><a href="/json">JSON</a></li>
|
||||
<li><a href="/jsonp?jsonp=myjson">JSONP</a></li>
|
||||
<li><a href="/json-halt">JSON Halt</a></li>
|
||||
<li><a href="/halt">Halt</a></li>
|
||||
<li><a href="/redirect">Redirect</a></li>
|
||||
</ul>';
|
||||
|
||||
Flight::before('start', function () {
|
||||
echo '<div id="container">';
|
||||
});
|
||||
|
||||
Flight::after('start', function () {
|
||||
echo '</div>';
|
||||
echo '<div id="debugrequest">';
|
||||
echo "Request information<pre>";
|
||||
print_r(Flight::request());
|
||||
echo "</pre>";
|
||||
echo "</div>";
|
||||
});
|
||||
|
||||
Flight::start();
|
||||
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace tests\views\components;
|
||||
|
||||
use flight\template\Component;
|
||||
use Override;
|
||||
|
||||
if (!class_exists('AnotherClassComponent')) {
|
||||
class AnotherClassComponent extends Component
|
||||
{
|
||||
#[Override]
|
||||
public function html(): string
|
||||
{
|
||||
return 'another-class-component';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<h1>Hello, <?= $occupation ?> <?= $name ?></h1>
|
||||
@ -0,0 +1 @@
|
||||
<h1>Hello, <?= $name ?></h1>
|
||||
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use tests\views\components\AnotherClassComponent;
|
||||
|
||||
require_once __DIR__ . '/another-class-component.php';
|
||||
|
||||
return new class extends AnotherClassComponent
|
||||
{
|
||||
#[Override]
|
||||
public function html(): string
|
||||
{
|
||||
return parent::html() . ' extended by my-class-component-that-extends-another-class-component';
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use flight\template\Component;
|
||||
|
||||
return new class extends Component
|
||||
{
|
||||
public function html(): string
|
||||
{
|
||||
return 'my-class-component-with-custom-script-tag';
|
||||
}
|
||||
|
||||
public function js(): string
|
||||
{
|
||||
return <<<'js'
|
||||
<script type="module" data-component="my-class-component-with-custom-script-tag">
|
||||
console.log('my-class-component-with-custom-script-tag')
|
||||
</script>
|
||||
js;
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use flight\template\Component;
|
||||
|
||||
return new class extends Component
|
||||
{
|
||||
public function html(): string
|
||||
{
|
||||
return <<<'html'
|
||||
<span class="my-class-component-with-custom-style-tag">
|
||||
my-class-component-with-custom-style-tag
|
||||
</span>
|
||||
html;
|
||||
}
|
||||
|
||||
public function css(): string
|
||||
{
|
||||
return <<<'css'
|
||||
<style media="print" data-component="my-class-component-with-custom-style-tag">
|
||||
.my-class-component-with-custom-style-tag {
|
||||
color: purple;
|
||||
}
|
||||
</style>
|
||||
css;
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use flight\template\Component;
|
||||
|
||||
return new class($name, $occupation) extends Component
|
||||
{
|
||||
private string $name;
|
||||
private string $occupation;
|
||||
|
||||
public function __construct(string $name, string $occupation)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->occupation = $occupation;
|
||||
}
|
||||
|
||||
public function html(): string
|
||||
{
|
||||
return "class-component-with-props: $this->occupation $this->name";
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use flight\template\Component;
|
||||
|
||||
return new class extends Component
|
||||
{
|
||||
#[Override]
|
||||
public function html(): string
|
||||
{
|
||||
return 'my-class-component-with-scripts';
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function js(): string
|
||||
{
|
||||
return <<<'js'
|
||||
console.log('my-class-component-with-scripts')
|
||||
js;
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use flight\template\Component;
|
||||
|
||||
return new class extends Component
|
||||
{
|
||||
#[Override]
|
||||
public function html(): string
|
||||
{
|
||||
return <<<'html'
|
||||
<span class="my-class-component-with-styles">
|
||||
my-class-component-with-styles
|
||||
</span>
|
||||
html;
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function css(): string
|
||||
{
|
||||
return <<<'css'
|
||||
.my-class-component-with-styles {
|
||||
color: red;
|
||||
}
|
||||
css;
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use flight\template\Component;
|
||||
|
||||
return new class extends Component
|
||||
{
|
||||
#[Override]
|
||||
public function html(): string
|
||||
{
|
||||
return 'my-class-component';
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,4 @@
|
||||
<div>
|
||||
my-component-with-subcomponent
|
||||
<f-subcomponent />
|
||||
</div>
|
||||
@ -0,0 +1 @@
|
||||
my-component
|
||||
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
return fn (string $name, string $occupation): string =>
|
||||
"functional-component-with-individual-props: $occupation $name";
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
return fn (...$props): string => sprintf(
|
||||
'functional-component-with-props: %s %s',
|
||||
$props[1] ?? '',
|
||||
$props[0] ?? ''
|
||||
);
|
||||
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
return fn (): string => 'my-functional-component';
|
||||
@ -0,0 +1 @@
|
||||
subcomponent
|
||||
@ -1 +1 @@
|
||||
Hello, <?php echo $name; ?>!
|
||||
Hello, <?= $name ?>!
|
||||
@ -0,0 +1,5 @@
|
||||
<f-my-class-component-with-styles />
|
||||
<f-my-class-component-with-styles />
|
||||
|
||||
<f-my-class-component-with-scripts />
|
||||
<f-my-class-component-with-scripts />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-class-component-that-extends-another-class-component />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-class-component-with-custom-script-tag />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-class-component-with-custom-style-tag />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-class-component-with-props name="<?= $name ?>" occupation="<?= $occupation ?>" />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-class-component-with-scripts />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-class-component-with-styles />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-class-component />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-component-from-another-path />
|
||||
@ -0,0 +1 @@
|
||||
<<?= $prefix ?>-my-component />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-component />
|
||||
@ -0,0 +1 @@
|
||||
<?php $this->render('components/my-component') ?>
|
||||
@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<f-greeting name="<?= $name ?>" />
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1 @@
|
||||
<f-greeting name="<?= $name ?>" />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-component-with-subcomponent />
|
||||
@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<f-greeting-with-two-props name="<?= $name ?>" occupation="<?= $occupation ?>" />
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1 @@
|
||||
<f-my-functional-component-with-individual-props occupation="<?= $occupation ?>" name="<?= $name ?>" />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-functional-component-with-props name="<?= $name ?>" occupation="<?= $occupation ?>" />
|
||||
@ -0,0 +1 @@
|
||||
<f-my-functional-component />
|
||||
@ -0,0 +1,7 @@
|
||||
<ul>
|
||||
<?php for ($i = 1; $i <= 2; ++$i) : ?>
|
||||
<li>
|
||||
<f-my-component />
|
||||
</li>
|
||||
<?php endfor ?>
|
||||
</ul>
|
||||
@ -0,0 +1,3 @@
|
||||
<f-my-component />
|
||||
<f-my-functional-component />
|
||||
<f-my-class-component />
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue