🧬 Nano is a zero-config, no skeleton, minimal Hyperf distribution that allows you to quickly build a Hyperf application with just a single PHP file.

Related tags

Miscellaneous nano
Overview

English | 中文

Financial Contributors on Open Collective Php Version Swoole Version Nano License

Nano, by Hyperf

Nano is a zero-config, no skeleton, minimal Hyperf distribution that allows you to quickly build a Hyperf application with just a single PHP file.

Purpose

The author of Svelte has said that "Frameworks are not tools for organizing your code, they are tools for organizing your mind". The biggest advantages of Nano is that it doesn't interrupt your mind of thought. The Nano is good at self-declaration that you have no need to know the details of the framework. You can read the code fastly and know what it's for. Write a complete Hyperf application with minimal code declarations.

Feature

  • No skeleton.
  • Fast startup.
  • Zero config.
  • Closure style.
  • Support all Hyperf features except annotations.
  • Compatible with all Hyperf components.

Example

Create a single PHP file, like index.php:

$method, ]; }); $app->run();">

use Hyperf\Nano\Factory\AppFactory;

require_once __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create('0.0.0.0', 9051);

$app->get('/', function () {

    $user = $this->request->input('user', 'nano');
    $method = $this->request->getMethod();

    return [
        'message' => "hello {$user}",
        'method' => $method,
    ];

});

$app->run();

Run the server:

php index.php start

That's all you need.

More Examples

Routing

$app inherits all methods from hyperf router.


use Hyperf\Nano\Factory\AppFactory;

require_once __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create();

$app->addGroup('/nano', function () use ($app) {
    $app->addRoute(['GET', 'POST'], '/{id:\d+}', function($id) {
        return '/nano/'.$id;
    });
    $app->put('/{name:.+}', function($name) {
        return '/nano/'.$name;
    });
});

$app->run();

DI Container


use Hyperf\Nano\ContainerProxy;
use Hyperf\Nano\Factory\AppFactory;

require_once __DIR__ . '/vendor/autoload.php';

class Foo {
    public function bar() {
        return 'bar';
    }   
}

$app = AppFactory::create();
$app->getContainer()->set(Foo::class, new Foo());

$app->get('/', function () {
    /** @var ContainerProxy $this */
    $foo = $this->get(Foo::class);
    return $foo->bar();
});

$app->run();

As a convention, $this is bind to ContainerProxy in all closures managed by nano, including middleware, exception handler and more.

Middleware


use Hyperf\Nano\Factory\AppFactory;

require_once __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create();

$app->get('/', function () {
    return $this->request->getAttribute('key');
});

$app->addMiddleware(function ($request, $handler) {
    $request = $request->withAttribute('key', 'value');
    return $handler->handle($request);
});

$app->run();

In addition to closure, all $app->addXXX() methods also accept class name as argument. You can pass any corresponding hyperf classes.

ExceptionHandler


use Hyperf\HttpMessage\Stream\SwooleStream;
use Hyperf\Nano\Factory\AppFactory;

require_once __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create();

$app->get('/', function () {
    throw new \Exception();
});

$app->addExceptionHandler(function ($throwable, $response) {
    return $response->withStatus('418')
        ->withBody(new SwooleStream('I\'m a teapot'));
});

$app->run();

Custom Command


use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Nano\Factory\AppFactory;

require_once __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create();

$app->addCommand('echo', function(){
    $this->get(StdoutLoggerInterface::class)->info('A new command called echo!');
});

$app->run();

To run this command, execute

php index.php echo

Event Listener


use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Framework\Event\BootApplication;
use Hyperf\Nano\Factory\AppFactory;

require_once __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create();

$app->addListener(BootApplication::class, function($event){
    $this->get(StdoutLoggerInterface::class)->info('App started');
});

$app->run();

Custom Process


use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Nano\Factory\AppFactory;

require_once __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create();

$app->addProcess(function(){
    while (true) {
        sleep(1);
        $this->get(StdoutLoggerInterface::class)->info('Processing...');
    }
});

$app->run();

Crontab


use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Nano\Factory\AppFactory;

require_once __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create();

$app->addCrontab('* * * * * *', function(){
    $this->get(StdoutLoggerInterface::class)->info('execute every second!');
});

$app->run();

Use Hyperf Component


use Hyperf\DB\DB;
use Hyperf\Nano\Factory\AppFactory;

require_once __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create();

$app->config([
    'db.default' => [
        'host' => env('DB_HOST', 'localhost'),
        'port' => env('DB_PORT', 3306),
        'database' => env('DB_DATABASE', 'hyperf'),
        'username' => env('DB_USERNAME', 'root'),
        'password' => env('DB_PASSWORD', ''),
    ]
]);

$app->get('/', function(){
    return DB::query('SELECT * FROM `user` WHERE gender = ?;', [1]);
});

$app->run();
Comments
  • [Question] Implementation of Hyperf View in Nano

    [Question] Implementation of Hyperf View in Nano

    Hi, how can I implement the Hyperf view to render page in Nano? Since the structure of configuration of Hyperf and Nano is different.

    Thanks in advance.

    opened by ljfreelancer88 13
  • addCrontab 添加的定时任务没有执行

    addCrontab 添加的定时任务没有执行

    $app->addCrontab('* * * * * *', function(){ $this->get(StdoutLoggerInterface::class)->info('execute every second!'); }); addCrontab 添加的定时任务没有运行执行

    opened by vincent66666 3
  • 使用phpstorm进行单元测试会报错

    使用phpstorm进行单元测试会报错

    使用phpstorm进行单元测试,会报错failed to open stream: No such file or directory /Users/xxx/Documents/study/clion/php-7.3.19/work/bin/php /Users/xxx/Documents/www/learnphp/hyperf/nano/vendor/bin/co-phpunit --configuration /Users/xxx/Documents/www/learnphp/hyperf/nano/phpunit.xml --filter "/(::testDi)( .*)?$/" HyperfTest\Nano\Cases\Http\ContainerTest /Users/xxx/Documents/www/learnphp/hyperf/nano/tests/Cases/Http/ContainerTest.php --teamcity PHP Warning: require_once(vendor/autoload.php): failed to open stream: No such file or directory in /Users/xxx/Documents/www/learnphp/hyperf/nano/tests/bootstrap.php on line 12

    opened by lanru 2
  • 无法使用config()自定义log_level

    无法使用config()自定义log_level

    $app->config([ StdoutLoggerInterface::class => [ 'log_level' => [ LogLevel::ALERT ] ] ]); 这种写法无法自定义log_level。 当然, $app->getContainer()->get(ConfigInterface::class)->set(StdoutLoggerInterface::class, [ 'log_level' => [ LogLevel::ALERT ] ]); 这种写法是可以的。

    个人建议 https://github.com/hyperf/nano/blob/master/src/App.php#L318 将array_merge_recursive 改为 array_merge

    opened by xiaoguo0426 2
  • Update swoole/ide-helper requirement from ^4.5.2 to ^5.0.0

    Update swoole/ide-helper requirement from ^4.5.2 to ^5.0.0

    Updates the requirements on swoole/ide-helper to permit the latest version.

    Release notes

    Sourced from swoole/ide-helper's releases.

    5.0.0

    PHP stubs for Swoole 5.0.0.

    Commits
    • 939352e document classes under namespace \Swoole\WebSocket
    • afbe6bd document alias methods between class \Swoole\Coroutine and class \Swoole\Coro...
    • 31fef08 use customized PHPDoc tag @​alias
    • e61f41f document more alias functions/methods
    • 10e9075 document alias functions/methods
    • 995f36b use PHP constants instead of int in method declarations
    • 0bdfe61 document new classes in Swoole 5.0.0
    • 62f8140 use customized PHPDoc annotation @​pseudocode-included
    • b82bbdb document class \Swoole\ExitException
    • 8fd4af2 document deprecated functions/methods
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update phpstan/phpstan requirement from ^0.12 to ^1.8

    Update phpstan/phpstan requirement from ^0.12 to ^1.8

    Updates the requirements on phpstan/phpstan to permit the latest version.

    Release notes

    Sourced from phpstan/phpstan's releases.

    1.8.0

    Major new features 🚀

    Bleeding edge 🔪

    If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon:

    includes:
    	- vendor/phpstan/phpstan/conf/bleedingEdge.neon
    

    Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more

    Improvements 🔧

    Bugfixes 🐛

    Function signature fixes 🤖

    ... (truncated)

    Commits
    • b7648d4 PHPStan 1.8.0
    • e08eff5 Collectors docs
    • f7bea8d rememberPossiblyImpureFunctionValues docs
    • 5fe9a5d Updated PHPStan to commit 59fb0a3b23c91e5b736c7b67d8a9fd075fc08211
    • 07b9dbe Update update-playground-runner.yml
    • e667a0b Skip phpstan-doctrine on PHP 7.2
    • 5f76cd2 Updated PHPStan to commit 78b12fa8fb276bb3594e1738ba92f8b3b12cdcd2
    • 5a8ccdb Update Symplify baseline
    • adb8acd Open 1.8-dev
    • 60baecd Prepare for 1.8.x by disabling some workflows on 1.7.x
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update phpstan/phpstan requirement from ^0.12 to ^1.7

    Update phpstan/phpstan requirement from ^0.12 to ^1.7

    Updates the requirements on phpstan/phpstan to permit the latest version.

    Release notes

    Sourced from phpstan/phpstan's releases.

    1.7.1

    Improvements 🔧

    • Simplify and cleanup ArraySliceFunctionReturnTypeExtension (#1341), thanks @​herndlm!

    Bugfixes 🐛

    Commits
    • e3baed2 PHPStan 1.7.1
    • e4f8a00 Updated PHPStan to commit c24aa5a165bf7e5bd1cd5edc2a6aedbc238a0de3
    • 627b79e Nicer reproduction
    • 7beee3d Reproduce Phalcon reflection issue
    • b7382f4 Updated PHPStan to commit 00ec4af19baf003e7ac33e99cfc17b1f40178165
    • 8bc88a7 Update command-line-usage.md
    • 2ad1485 Update discovering-symbols.md
    • bd37e80 Document new errorFormat parameter
    • 69999be Document immutable PHPDoc tag
    • 4f12bce Document readonly PHPDoc tag
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update phpstan/phpstan requirement from ^0.12 to ^1.6

    Update phpstan/phpstan requirement from ^0.12 to ^1.6

    Updates the requirements on phpstan/phpstan to permit the latest version.

    Release notes

    Sourced from phpstan/phpstan's releases.

    1.6.0

    Read the article about PHPStan 1.6.0 »

    Major new features 🚀

    • Conditonal return types (pull requests), #3853, big thanks to @​rvanvelzen!
      • Allows return types in the form of @return ($i is positive-int ? non-empty-array : array) (don't forget the parentheses!)
      • Another possible form is with generic @template tags: @return (T is positive-int ? non-empty-array : array)
    • int-mask<...> and int-mask-of<...> types (#1166), thanks @​rvanvelzen!
    • Allow global constants as PHPDoc types (#1163), thanks @​rvanvelzen!
    • Update php-8-stubs to know about PHP 8.1 function signature changes, #7017, #6448
    • Make isset() and null-coalesce (??) operators consistent with each other (#1223), thanks @​rajyan!
      • New option checkDynamicProperties to restore the original stricter behaviour (#1234), thanks @​rajyan!

    Bleeding edge 🔪

    • Fully static reflection engine
      • After feedback is gathered and processed, this will be enabled for everyone later in PHPStan 1.x release cycle.
    • Lower memory consumption thanks to breaking up of reference cycles
      • This is a BC break for rules that use 'parent', 'next', and 'previous' node attributes. Learn more »
      • In testing the memory consumption was reduced by 50–70 %.
    • ArrayUnpackingRule (level 3) (#856), thanks @​canvural!
    • Rules for checking direct calls to __construct() (level 2) (#1208), #7022, thanks @​muno92!
    • checkMissingIterableValueType: false no longer does anything (https://github.com/phpstan/phpstan-src/commit/50d0c8e23ea85da508ab8481f1ff2c89148cc80b)

    If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon:

    includes:
    	- vendor/phpstan/phpstan/conf/bleedingEdge.neon
    

    Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more

    Improvements 🔧

    Bugfixes 🐛

    ... (truncated)

    Commits
    • b480ba2 PHPStan 1.6.0
    • 458a77a Updated PHPStan to commit 831469c9c406f18e537dd8c46b8b9b28a3897450
    • 9cca184 Updated PHPStan to commit a8d9628f2187b1d8a68eb75f5bb1f3dec2334854
    • 77d6be0 Updated PHPStan to commit d2bb725c61f44bf27907bbafd037e3d5940be532
    • 2e065bf Update Composer baseline
    • 1f1e656 Updated PHPStan to commit 867e655e75c755b919ed2013aa34e02736d48f57
    • 9521f5a Updated PHPStan to commit 3c7d9c8dcf6a01a2dc5c9b606577dcf87fb8ad65
    • 50cadaa Updated PHPStan to commit 1ffed9b90db23e69b306107db302e3a4b8418b83
    • f7a95c0 Updated PHPStan to commit 84f64f0af98665004d16f80d3cfbf8c062774650
    • 3bb3f73 Updated PHPStan to commit 201cc08f045aa6b382588f028a7870b9eeef2830
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update phpstan/phpstan requirement from ^0.12 to ^1.5

    Update phpstan/phpstan requirement from ^0.12 to ^1.5

    Updates the requirements on phpstan/phpstan to permit the latest version.

    Release notes

    Sourced from phpstan/phpstan's releases.

    1.5.0

    This release fixes 26 issues! 🎉

    Improvements 🔧

    Bleeding edge 🔪

    If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon:

    includes:
    	- vendor/phpstan/phpstan/conf/bleedingEdge.neon
    

    Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more

    Bugfixes 🐛

    Function signature fixes 🤖

    ... (truncated)

    Commits
    • 2be8dd6 PHPStan 1.5.0
    • 6aa6b41 Update PMMP baseline
    • 0156796 Updated PHPStan to commit a355aaa147429b6ba07ab1c8ebc418b8b647127e
    • 176af8b Updated PHPStan to commit 707f57a595ac791564e20c006abe44dfd34de35d
    • a74dd8b Updated PHPStan to commit ee4e92984536e72023fbc0a7e06fe82cef4cd0a2
    • 79584b4 Updated PHPStan to commit 8e4ef885b22f1d252c35d01b3aa77ce34bac80bd
    • a1028a7 Update Composer baseline
    • b3424a7 Updated PHPStan to commit ddbae3e2d65d65067ae78288880c22baae5c8eb7
    • 9f6cec4 Updated PHPStan to commit 9cde41375bc3dde9516ce3af2fed0143f3bfbf94
    • 3a2aa04 Updated PHPStan to commit 796f712ac198654360c22b6f9608ad496231a6d3
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update phpstan/phpstan requirement from ^0.12 to ^1.4

    Update phpstan/phpstan requirement from ^0.12 to ^1.4

    Updates the requirements on phpstan/phpstan to permit the latest version.

    Release notes

    Sourced from phpstan/phpstan's releases.

    1.4.0

    This release fixes 25 issues! 🎉

    Major new features 🚀

    • Support for PHP 8.1 readonly properties (RFC)
      • Readonly properties must be assigned in the constructor of the declaring class
      • Memoized type of a readonly property is not invalidated even when calling a method with side effects
      • Readonly properties cannot be passed by reference
    • Improved detection of incorrect types assigned to properties:

    Improvements 🔧

    Bugfixes 🐛

    Thanks to some internal refactorings listed below, the following issues have been fixed: #5337, #4910, #5316, #5607, #3766, #3858, #3310, #3264, #2806, #5328, #3044, #6184, #3339, #5656, #5362, #3867, #5707

    Function signature fixes 🤖

    Commits
    • 72b04d9 PHPStan 1.4.0
    • 57932e4 Updated PHPStan to commit cbb796380815485a9986a0945f1c5b6657a60ba1
    • d6b0f46 Updated PHPStan to commit 44fd938c30de5ee87f41b9c97b3d79ec18a731fa
    • 15bcf03 Updated PHPStan to commit 28bd563fbafe2f4a884a6e77bba0149df98a8b93
    • 890348f Updated PHPStan to commit 456a41940b1b045087c5549a4043651aa77b7823
    • 05ccf02 Updated PHPStan to commit d50d5e4f4bce7699751c4a09a20cc7ee4057ce28
    • 3b8834d Updated PHPStan to commit e64d6142589df16bf526f4217a561f00600c869c
    • e680a21 Updated PHPStan to commit 7ca26f7d82b27dfa38913b737568951bbd3363c8
    • 5b33059 Update PHPUnit baseline
    • 2177005 Updated PHPStan to commit 6d7ba0f0db550df34aac51af3a0f8f13e710ca0c
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update phpstan/phpstan requirement from ^0.12 to ^1.3

    Update phpstan/phpstan requirement from ^0.12 to ^1.3

    Updates the requirements on phpstan/phpstan to permit the latest version.

    Release notes

    Sourced from phpstan/phpstan's releases.

    1.3.0

    Major new features 🚀

    • Support for PHP 8.1 Enums - RFC
    • Upgraded Roave/BetterReflection to 5.0.0
      • PHP 7.1+ is still supported because the dependency is downgraded automatically in our own fork
      • This brings plenty of bugfixes, for example PHP 8.0 Attributes can now be read in static reflection context
    • PHPStan now works when OPCache is enabled!
    • The development repository phpstan/phpstan-src is now PHP 8.0+ only, while the distribution package phpstan/phpstan still supports PHP 7.1+.
      • This is achieved thanks to automatic downgrade of source code using Rector during PHAR compilation
      • PHPStan now ships with Symfony PHP polyfills for PHP 7.2-8.0.

    Improvements 🔧

    Bugfixes 🐛

    ... (truncated)

    Commits
    • ffc5aee PHPStan 1.3.0
    • 04e47a6 Updated PHPStan to commit 71572f9a1e6407ce79aa163b0b9eacf2e48b47b0
    • 054b08c Updated PHPStan to commit 20f5877705d42e696c64a18d4efcb1d1557b9df2
    • f61e569 Updated PHPStan to commit 8e38b5b1821c171bc017890efa4c959c630286b3
    • 984615b Updated PHPStan to commit 6e63bf720b7bd027d10fef50821fca34b7d4f90a
    • b467936 Updated PHPStan to commit fe9a0fd411ac9be5120f587d9811e1d91531e0b8
    • 1e8501b Updated PHPStan to commit 7210d0af951e96182d6737722db11e4e1c6a8569
    • 9ba890e Updated PHPStan to commit bbb79b7483872062515b204a2285707b73e37547
    • e6ce774 Updated PHPStan to commit 53d6565edf734fc48933a80a8a9898f13adb3753
    • 90ad22f Updated PHPStan to commit abf3cbe9e76de8fd8767283f858717f922f109d4
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Update swoole/ide-helper requirement from ^4.5.2 to ^5.0.1

    Update swoole/ide-helper requirement from ^4.5.2 to ^5.0.1

    Updates the requirements on swoole/ide-helper to permit the latest version.

    Release notes

    Sourced from swoole/ide-helper's releases.

    5.0.1

    PHP stubs for Swoole 5.0.1.

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • 安装 php-cs-fixer 和 phpstan 之后无法 ctrl + c 退出进程

    安装 php-cs-fixer 和 phpstan 之后无法 ctrl + c 退出进程

    环境

    • PHP
    $ php -v
    PHP 8.1.4 (cli) (built: Mar 18 2022 09:46:02) (NTS)
    Copyright (c) The PHP Group
    Zend Engine v4.1.4, Copyright (c) Zend Technologies
        with Zend OPcache v8.1.4, Copyright (c), by Zend Technologies
    
    • Swoole
    $ php --ri swoole
    
    swoole
    
    Swoole => enabled
    Author => Swoole Team <[email protected]>
    Version => 4.8.10
    Built => Jul 16 2022 13:16:55
    coroutine => enabled with boost asm context
    kqueue => enabled
    rwlock => enabled
    sockets => enabled
    openssl => OpenSSL 1.1.1p  21 Jun 2022
    dtls => enabled
    http2 => enabled
    json => enabled
    curl-native => enabled
    pcre => enabled
    zlib => 1.2.11
    brotli => E16777225/D16777225
    mysqlnd => enabled
    async_redis => enabled
    
    Directive => Local Value => Master Value
    swoole.enable_coroutine => On => On
    swoole.enable_library => On => On
    swoole.enable_preemptive_scheduler => Off => Off
    swoole.display_errors => On => On
    swoole.use_shortname => Off => Off
    swoole.unixsock_buffer_size => 262144 => 262144
    
    • Hyperf
    $ composer info|grep hyperf
    hyperf/command                     dev-master 525abc7 Command for hyperf
    hyperf/config                      dev-master 9344eb2 An independent component that provides configuration container.
    hyperf/context                     dev-master a072131 A coroutine context library.
    hyperf/contract                    dev-master c8e7aa0 The contracts of Hyperf.
    hyperf/coordinator                 dev-master 5c08f65 Hyperf Coordinator
    hyperf/di                          dev-master 99062a6 A DI for Hyperf.
    hyperf/dispatcher                  dev-master b680b15 A HTTP Server for Hyperf.
    hyperf/engine                      1.3.x-dev b94510c 
    hyperf/event                       dev-master d9950a0 an event manager that implements PSR-14.
    hyperf/exception-handler           dev-master e27e373 Exception handler for hyperf
    hyperf/framework                   dev-master 09c4981 A coroutine framework that focuses on hyperspeed and flexible, ...
    hyperf/http-message                dev-master f64a2aa microservice framework base on swoole
    hyperf/http-server                 dev-master d3e1faf A HTTP Server for Hyperf.
    hyperf/macroable                   dev-master bfd332f Hyperf Macroable package which come from illuminate/macroable
    hyperf/nano                        dev-master b99a7cf Scale Hyperf application down to a single file
    hyperf/server                      dev-master 467d400 A base server library for Hyperf.
    hyperf/utils                       dev-master 00f17d8 A tools package that could help developer solved the problem qu...
    

    复现步骤

    1. 创建 nano 应用
    {
        "require": {
            "hyperf/nano": "dev-master"
        },
        "minimum-stability": "dev"
    }
    

    composer install 安装 hyperf/nano

    1. 创建入口文件(readme 的代码)
    <?php
    use Hyperf\Nano\Factory\AppFactory;
    
    require_once __DIR__ . '/vendor/autoload.php';
    
    $app = AppFactory::create();
    
    $app->get('/', function () {
    
        $user = $this->request->input('user', 'nano');
        $method = $this->request->getMethod();
    
        return [
            'message' => "hello {$user}",
            'method' => $method,
        ];
    
    });
    
    $app->run();
    
    1. 运行 php app.php start,然后 ctrl + c 能正常退出

    2. 安装 php-cs-fixerphpstan

    composer require friendsofphp/php-cs-fixer:^3.0 --dev
    composer require phpstan/phpstan:^1.0 --dev
    
    1. 运行 php app.php startctrl + c无法正常退出
    opened by huangdijia 0
Releases(v2.0.0-beta.1)
Owner
Hyperf
A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.
Hyperf
📦🚀 Fast, zero config application bundler with PHARs.

Fork of the unmaintained box2 project. This project needs your help! Upgrading from Box2? Checkout the upgrade guide! Goal The Box application simplif

Box Project 865 Dec 26, 2022
Simple user settings facade for Hyperf. Settings are stored as JSON in a single database column, so you can easily add it to an existing table.

hyperf-user-settings Simple user settings util for hyperf Settings are stored as JSON in a single database column, so you can easily add it to an exis

lysice 1 Oct 15, 2021
Osclass Enterprise allows you to quickly build your own classifieds site for free.

Osclass Enterprise Osclass Enterprise is a fork of the Osclass v3.8.0 repository, containing many fixes and improvements (check the CHANGELOG). Releas

null 6 Dec 20, 2022
A wrapper around symplify/config-transformer used to update recipes and using easy coding standard for generating readable config files.

Symfony Recipes Yaml to PHP Converter This is a wrapper around the symplify/config-transformer used to convert Symfony core recipes which uses .yaml c

Alexander Schranz 3 Nov 24, 2022
WordPlate is a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

WordPlate is simply a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

WordPlate 1.7k Dec 24, 2022
Laravel Larex lets you translate your whole Laravel application with a single CSV file.

Laravel Larex Laravel Larex lets you translate your whole Laravel application with a single CSV file. You can import translation entries from lang fol

Luca Patera 68 Dec 12, 2022
A PHP library that can be used manually as well as a CLI script that you can just run on your file

Run phpcs on files and only report new warnings/errors compared to the previous version. This is both a PHP library that can be used manually as well

Payton Swick 20 Aug 4, 2022
It is a simple blog application coded with PHP, HTML, CSS. You can develop, edit. You can see it as a skeleton. ⚡

PHP-BLOG-SYSTEM Simple blog system Features Adding Text Update Text Text Deletion User Login and register Bootstrap Design Profile Page How to use blo

Selçuk 2 Aug 21, 2022
Minimal HTML login page that uses a json file as a database

JSONlogin Minimal HTML login page that uses a json file as a database Minimal login system that requires a new user to input username, password and th

null 12 Jul 5, 2022
You have just downloaded "Messenger-app" [A lightweight, minimalistic real-time chat application]

MESSENGER-APP You have just downloaded "Messenger-app" [A lightweight, minimalistic real-time chat application] Setup To get it working, follow these

Chr1st0ph3r SAB 1 Oct 29, 2021
CrateKeyShopGUI Pocketmine-MP plugin which can be set in Config.yml file

CrateKeyShopGUI CrateKeyShopGUI Pocketmine-MP plugin which can be set in Config.yml file Depend FormAPI EconomyAPI PiggyCrate InvCrashFix Download Dow

null 4 Jan 7, 2022
Write to Laravel Config files and maintain file integrity

Laravel Config Writer Write to Laravel Config files and maintain file integrity. This library is an extension of the Config component used by Laravel.

Sam Geo 158 Dec 30, 2022
Optimizes class loading performance by generating a single PHP file containing all of the autoloaded files.

Class Preloader for PHP This tool is used to generate a single PHP script containing all of the classes required for a specific use case. Using a sing

Class Preloader 356 Nov 26, 2022
High-performance, low-memory-footprint, single-file embedded database for key/value storage

LDBA - a fast, pure PHP, key-value database. Information LDBA is a high-performance, low-memory-footprint, single-file embedded database for key/value

Simplito 12 Nov 13, 2022
Simple, single-file and dependency-free AWS S3 client.

Simple, single-file and dependency-free AWS S3 client. Why? In some scenarios we want the simplest and lightest S3 client possible. For example in Bre

Matthieu Napoli 28 Nov 15, 2022
Allows Admins to quickly login as any user in the system during development/testing

SilverStripe User Switcher The module adds a small form both in the frontend to quickly login as any user in the system. The intended use is in testin

LiveSource 15 Mar 1, 2021
Magento 2 Preview/Visit Catalog allows the store owner to quickly preview the catalog (product & category) pages from the admin panel.

Magento 2 Preview/Visit Catalog Overview Magento 2 Preview/Visit Catalog allows the store owner to quickly preview the catalog (product & category) pa

Raj KB 4 Sep 27, 2022
A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2

Simple Import / Export tool A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2. Table data

EcomDev B.V. 51 Dec 5, 2022