Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6ed899c
feat: copy source code from laravel
bluehaha Oct 15, 2025
d78e603
feat: change namespace from Illuminate to Hypervel
bluehaha Oct 15, 2025
09555f8
feat: add type hints
bluehaha Oct 15, 2025
a2a12fb
feat: copy test from Laravel
bluehaha Oct 15, 2025
2902396
feat: use Hypervel namespace
bluehaha Oct 15, 2025
32d63b5
feat: use strict type
bluehaha Oct 15, 2025
c02c360
feat: add view package in composer
bluehaha Oct 15, 2025
327d7fb
feat: add contracts
bluehaha Oct 15, 2025
cbb8e28
style: remove useless type hint
bluehaha Oct 31, 2025
8286d7a
test: beautify test
bluehaha Oct 31, 2025
7efe459
Merge branch 'main' into feature/view
bluehaha Nov 3, 2025
d4103ac
fix: fix namespace
bluehaha Nov 5, 2025
333f59f
refactor: add type hint
bluehaha Nov 5, 2025
66321b0
feat: migrate compilers and engines
bluehaha Nov 5, 2025
4d4c6f2
refactor: add type hints
bluehaha Nov 5, 2025
29531a3
feat: migrate Compilers
bluehaha Nov 13, 2025
4d9bae7
feat: migrate Laravel view
bluehaha Nov 28, 2025
0be9324
feat: use constructor property promotion
bluehaha Nov 28, 2025
5a81433
feat: migrate Laravel view
bluehaha Dec 17, 2025
011c576
feat: migrate Laravel view
bluehaha Dec 22, 2025
2eaebe3
feat: return Html component
bluehaha Dec 22, 2025
df3daa6
feat: migrate Laravel view
bluehaha Dec 22, 2025
117b966
feat: migrate Laravel view
bluehaha Dec 23, 2025
e5ee166
Merge branch 'main' into feature/view
bluehaha Dec 29, 2025
860a552
feat: migrate Laravel view
bluehaha Dec 29, 2025
e6ca111
fix: fix cs
bluehaha Dec 29, 2025
34806cc
fix: need to save session
bluehaha Dec 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"Hypervel\\Translation\\": "src/translation/src/",
"Hypervel\\Validation\\": "src/validation/src/",
"Hypervel\\Permission\\": "src/permission/src/",
"Hypervel\\Sentry\\": "src/sentry/src/"
"Hypervel\\Sentry\\": "src/sentry/src/",
"Hypervel\\View\\": "src/view/src/"
},
"files": [
"src/auth/src/Functions.php",
Expand Down Expand Up @@ -182,7 +183,8 @@
"hypervel/translation": "self.version",
"hypervel/validation": "self.version",
"hypervel/permission": "self.version",
"hypervel/sentry": "self.version"
"hypervel/sentry": "self.version",
"hypervel/view": "self.version"
},
"suggest": {
"hyperf/redis": "Required to use redis driver. (^3.1).",
Expand Down Expand Up @@ -261,7 +263,8 @@
"providers": [
"Hypervel\\Notifications\\NotificationServiceProvider",
"Hypervel\\Telescope\\TelescopeServiceProvider",
"Hypervel\\Sentry\\SentryServiceProvider"
"Hypervel\\Sentry\\SentryServiceProvider",
"Hypervel\\View\\ViewServiceProvider"
]
},
"branch-alias": {
Expand Down
3 changes: 0 additions & 3 deletions src/core/src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
use Hyperf\Database\Commands\Migrations\StatusCommand;
use Hyperf\Database\Migrations\MigrationCreator as HyperfMigrationCreator;
use Hyperf\Database\Model\Factory as HyperfDatabaseFactory;
use Hyperf\ViewEngine\Compiler\CompilerInterface;
use Hypervel\Database\Console\SeedCommand;
use Hypervel\Database\Eloquent\Factories\LegacyFactoryInvoker as DatabaseFactoryInvoker;
use Hypervel\Database\Migrations\MigrationCreator;
use Hypervel\Database\TransactionListener;
use Hypervel\View\CompilerFactory;

class ConfigProvider
{
Expand All @@ -31,7 +29,6 @@ public function __invoke(): array
'dependencies' => [
HyperfDatabaseFactory::class => DatabaseFactoryInvoker::class,
HyperfMigrationCreator::class => MigrationCreator::class,
CompilerInterface::class => CompilerFactory::class,
],
'listeners' => [
TransactionListener::class,
Expand Down
30 changes: 0 additions & 30 deletions src/core/src/View/CompilerFactory.php

This file was deleted.

35 changes: 0 additions & 35 deletions src/core/src/View/Compilers/BladeCompiler.php

This file was deleted.

24 changes: 0 additions & 24 deletions src/core/src/View/Compilers/Concerns/CompilesHelpers.php

This file was deleted.

32 changes: 0 additions & 32 deletions src/core/src/View/Middleware/ShareErrorsFromSession.php

This file was deleted.

10 changes: 8 additions & 2 deletions src/devtool/src/Generator/ComponentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Hypervel\Devtool\Generator;

use Hyperf\Devtool\Generator\GeneratorCommand;
use Hypervel\Support\Str;

class ComponentCommand extends GeneratorCommand
{
Expand All @@ -27,7 +28,7 @@ protected function getStub(): string

protected function getDefaultNamespace(): string
{
return $this->getConfig()['namespace'] ?? 'App\View\Component';
return $this->getConfig()['namespace'] ?? 'App\View\Components';
}

protected function buildClass(string $name): string
Expand All @@ -37,7 +38,12 @@ protected function buildClass(string $name): string

protected function replaceView(string $stub, string $name): string
{
$view = lcfirst(str_replace($this->getNamespace($name) . '\\', '', $name));
$view = str_replace($this->getDefaultNamespace() . '\\', '', $name);
$view = array_map(
fn ($part) => Str::snake($part),
explode('\\', $view)
);
$view = implode('.', $view);

return str_replace(
['%VIEW%'],
Expand Down
6 changes: 3 additions & 3 deletions src/devtool/src/Generator/stubs/view-component.stub
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ declare(strict_types=1);
namespace %NAMESPACE%;

use Closure;
use Hyperf\ViewEngine\Component\Component;
use Hyperf\ViewEngine\Contract\ViewInterface;
use Hypervel\View\Component;
use Hypervel\View\Contracts\View as ViewContract;
use Hypervel\Support\Facades\View;

class %CLASS% extends Component
Expand All @@ -22,7 +22,7 @@ class %CLASS% extends Component
/**
* Get the view / contents that represent the component.
*/
public function render(): ViewInterface|Closure|string
public function render(): ViewContract|Closure|string
{
return %VIEW%;
}
Expand Down
22 changes: 22 additions & 0 deletions src/filesystem/src/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Hypervel\Filesystem;

use Hyperf\Support\Filesystem\Filesystem as HyperfFilesystem;
use Hypervel\Http\Exceptions\FileNotFoundException;

class Filesystem extends HyperfFilesystem
{
Expand All @@ -17,4 +18,25 @@ public function ensureDirectoryExists(string $path, int $mode = 0755, bool $recu
$this->makeDirectory($path, $mode, $recursive);
}
}

/**
* Get the returned value of a file.
*
* @throws FileNotFoundException
*/
public function getRequire(string $path, array $data = [[]])
{
if ($this->isFile($path)) {
$__path = $path;
$__data = $data;

return (static function () use ($__path, $__data) {
extract($__data, EXTR_SKIP);

return require $__path;
})();
}

throw new FileNotFoundException("File does not exist at path {$path}.");
}
}
4 changes: 4 additions & 0 deletions src/foundation/src/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,10 @@ protected function withErrors(Request $request, mixed $provider, string $key = '
if ($flashInputs) {
$session->flashInput($flashInputs);
}

// Because an exception is thrown and the reset logic of `StartSession` middleware is not executed,
// We need to save the session here manually.
$session->save();
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/foundation/src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Hyperf\Contract\Arrayable;
use Hyperf\HttpMessage\Cookie\Cookie;
use Hyperf\Stringable\Stringable;
use Hyperf\ViewEngine\Contract\FactoryInterface;
use Hyperf\ViewEngine\Contract\ViewInterface;
use Hypervel\Auth\Contracts\Factory as AuthFactoryContract;
use Hypervel\Auth\Contracts\Gate;
use Hypervel\Auth\Contracts\Guard;
Expand All @@ -33,6 +31,8 @@
use Hypervel\Translation\Contracts\Translator as TranslatorContract;
use Hypervel\Validation\Contracts\Factory as ValidatorFactoryContract;
use Hypervel\Validation\Contracts\Validator as ValidatorContract;
use Hypervel\View\Contracts\Factory as FactoryContract;
use Hypervel\View\Contracts\View as ViewContract;
use Psr\Http\Message\ResponseInterface;
use Psr\Log\LoggerInterface;

Expand Down Expand Up @@ -770,9 +770,9 @@ function __(?string $key = null, array $replace = [], ?string $locale = null): a
* @param null|string $view
* @param array $mergeData
*/
function view($view = null, array|Arrayable $data = [], $mergeData = []): FactoryInterface|ViewInterface
function view($view = null, array|Arrayable $data = [], $mergeData = []): FactoryContract|ViewContract
{
$factory = app(FactoryInterface::class);
$factory = app(FactoryContract::class);

if (func_num_args() === 0) {
return $factory;
Expand Down
7 changes: 7 additions & 0 deletions src/http/src/CoreMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Hyperf\HttpServer\Router\DispatcherFactory;
use Hyperf\Server\Exception\ServerException;
use Hyperf\View\RenderInterface;
use Hyperf\ViewEngine\Contract\Htmlable;
use Hyperf\ViewEngine\Contract\Renderable;
use Hyperf\ViewEngine\Contract\ViewInterface;
use Hypervel\Context\ResponseContext;
Expand Down Expand Up @@ -65,6 +66,12 @@ protected function transferToResponse($response, ServerRequestInterface $request
->setBody(new SwooleStream($response->render()));
}

if ($response instanceof Htmlable) {
return $this->response()
->addHeader('content-type', 'text/html')
->setBody(new SwooleStream((string) $response));
}

if (is_string($response)) {
return $this->response()->addHeader('content-type', 'text/plain')->setBody(new SwooleStream($response));
}
Expand Down
4 changes: 2 additions & 2 deletions src/session/src/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
use Hyperf\Context\Context;
use Hyperf\Macroable\Macroable;
use Hyperf\Stringable\Str;
use Hyperf\Support\MessageBag;
use Hyperf\ViewEngine\ViewErrorBag;
use Hypervel\Session\Contracts\Session;
use Hypervel\Support\MessageBag;
use Hypervel\Support\ViewErrorBag;
use SessionHandlerInterface;
use stdClass;

Expand Down
4 changes: 4 additions & 0 deletions src/support/src/Contracts/MessageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@

interface MessageProvider extends HyperfMessageProvider
{
/**
* Get the messages for the instance.
*/
public function getMessageBag(): MessageBag;
}
1 change: 1 addition & 0 deletions src/support/src/DefaultProviders.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function __construct(?array $providers = null)
$this->providers = $providers ?: [
\Hypervel\Foundation\Providers\FoundationServiceProvider::class,
\Hypervel\Foundation\Providers\FormRequestServiceProvider::class,
\Hypervel\View\ViewServiceProvider::class,
];
}

Expand Down
Loading
Loading