diff --git a/publish/view.php b/publish/view.php index 100613e..7fc7bf1 100644 --- a/publish/view.php +++ b/publish/view.php @@ -9,15 +9,14 @@ * @contact group@hyperf.io * @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', ], ]; diff --git a/src/Engine/NoneEngine.php b/src/Engine/NoneEngine.php new file mode 100644 index 0000000..bad2fa5 --- /dev/null +++ b/src/Engine/NoneEngine.php @@ -0,0 +1,57 @@ + + + + + + + Hyperf + + + + + +
+
+

Hyperf

+

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.

+

Learn more

+

This view engine is not available, please use engines below.

+ +
+
+ + +HTML; + } +} diff --git a/src/Render.php b/src/Render.php index 1689c6b..760fea5 100644 --- a/src/Render.php +++ b/src/Render.php @@ -17,7 +17,7 @@ use Hyperf\Task\TaskExecutor; use Hyperf\Utils\Context; use Hyperf\View\Engine\EngineInterface; -use Hyperf\View\Engine\SmartyEngine; +use Hyperf\View\Engine\NoneEngine; use Hyperf\View\Exception\EngineNotFindException; use Hyperf\View\Exception\RenderException; use Psr\Container\ContainerInterface; @@ -47,7 +47,7 @@ class Render implements RenderInterface public function __construct(ContainerInterface $container, ConfigInterface $config) { - $engine = $config->get('view.engine', SmartyEngine::class); + $engine = $config->get('view.engine', NoneEngine::class); if (! $container->has($engine)) { throw new EngineNotFindException("{$engine} engine is not found."); } diff --git a/tests/NoneTest.php b/tests/NoneTest.php new file mode 100644 index 0000000..ffd4654 --- /dev/null +++ b/tests/NoneTest.php @@ -0,0 +1,29 @@ +render('/', [], []); + + $this->assertNotEmpty($content); + } +}