-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 2.1-merge
- Loading branch information
Showing
4 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,15 +9,14 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use Hyperf\View\Engine\NoneEngine; | ||
use Hyperf\View\Mode; | ||
use Hyperf\ViewEngine\HyperfViewEngine; | ||
|
||
return [ | ||
'engine' => HyperfViewEngine::class, | ||
'engine' => NoneEngine::class, | ||
'mode' => Mode::SYNC, | ||
'config' => [ | ||
'view_path' => BASE_PATH . '/storage/view/', | ||
'cache_path' => BASE_PATH . '/runtime/view/', | ||
'charset' => 'UTF-8', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
namespace Hyperf\View\Engine; | ||
|
||
class NoneEngine implements EngineInterface | ||
{ | ||
public function render($template, $data, $config): string | ||
{ | ||
return <<<'HTML' | ||
<!DOCTYPE html> | ||
<html lang="zh"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Hyperf</title> | ||
<!-- Fonts --> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="jumbotron"> | ||
<h1>Hyperf</h1> | ||
<p>Hyperf is an extremely performant and flexible PHP CLI framework based on Swoole 4.5+, powered by the | ||
state-of-the-art coroutine server and a large number of battle-tested components. Aside from the decisive | ||
benchmark outmatching against PHP-FPM frameworks, Hyperf also distinct itself by its focus on flexibility | ||
and composability. Hyperf ships with an AOP-enabling dependency injector to ensure components and classes | ||
are pluggable and meta programmable. All of its core components strictly follow the PSR standards and thus | ||
can be used in other frameworks.</p> | ||
<p><a class="btn btn-primary btn-lg" href="https://hyperf.wiki/" role="button">Learn more</a></p> | ||
<p>This view engine is not available, please use engines below.</p> | ||
<ul class="list-group"> | ||
<li class="list-group-item"><a href="https://github.com/hyperf/view-engine">hyperf/view-engine</a></li> | ||
<li class="list-group-item"><a href="https://github.com/duncan3dc/blade">duncan3dc/blade</a></li> | ||
<li class="list-group-item"><a href="https://github.com/smarty-php/smarty">smarty/smarty</a></li> | ||
<li class="list-group-item"><a href="https://github.com/twigphp/Twig">twig/twig</a></li> | ||
<li class="list-group-item"><a href="https://github.com/thephpleague/plates">league/plates</a></li> | ||
<li class="list-group-item"><a href="https://github.com/sy-records/think-template">sy-records/think-template</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</body> | ||
</html> | ||
HTML; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
* @link https://www.hyperf.io | ||
* @document https://hyperf.wiki | ||
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
namespace HyperfTest\View; | ||
|
||
use Hyperf\View\Engine\NoneEngine; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @internal | ||
* @coversNothing | ||
*/ | ||
class NoneTest extends TestCase | ||
{ | ||
public function testRender() | ||
{ | ||
$content = (new NoneEngine())->render('/', [], []); | ||
|
||
$this->assertNotEmpty($content); | ||
} | ||
} |