├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── php.yml │ └── release.yml ├── .gitignore ├── .php-cs-fixer.php ├── LICENSE ├── Makefile ├── README.md ├── README.zh-CN.md ├── TODO.md ├── composer.json ├── phpunit.xml ├── run.php ├── script ├── release-tag.sh ├── subtree-add.sh ├── subtree-intro.md ├── subtree-pull.sh ├── subtree-push.sh ├── subtree-split.sh └── template │ └── README.tpl └── src ├── amqp ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── .gitignore ├── LICENSE ├── README.md ├── composer.json └── src │ ├── Amqp.php │ ├── AutoLoader.php │ ├── Client.php │ ├── Connection │ ├── Connection.php │ ├── ConnectionManager.php │ ├── SSLConnection.php │ ├── SocketConnection.php │ └── StreamConnection.php │ ├── Connector │ └── AMQPConnector.php │ ├── Contract │ ├── ConnectionInterface.php │ └── ConnectorInterface.php │ ├── Exception │ └── AMQPException.php │ └── Pool.php ├── apollo ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src │ ├── Apollo.php │ ├── AutoLoader.php │ ├── Config.php │ ├── Contract │ │ └── ConfigInterface.php │ └── Exception │ │ └── ApolloException.php └── test │ ├── bootstrap.php │ ├── config │ └── base.php │ ├── testing │ ├── AutoLoader.php │ └── bean.php │ └── unit │ └── ApolloTest.php ├── breaker ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src │ ├── Annotation │ │ ├── Mapping │ │ │ └── Breaker.php │ │ └── Parser │ │ │ └── BreakerParser.php │ ├── Aspect │ │ └── BreakerAspect.php │ ├── AutoLoader.php │ ├── Breaker.php │ ├── BreakerManager.php │ ├── BreakerRegister.php │ ├── Contract │ │ └── StateInterface.php │ ├── Exception │ │ └── BreakerException.php │ ├── Listener │ │ └── AppInitCompleteListener.php │ └── State │ │ ├── AbstractState.php │ │ ├── CloseState.php │ │ ├── HalfOpenState.php │ │ └── OpenState.php └── test │ ├── bootstrap.php │ ├── config │ └── base.php │ ├── testing │ ├── AutoLoader.php │ ├── BreakerBean.php │ └── bean.php │ └── unit │ └── BreakerTest.php ├── consul ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src │ ├── Agent.php │ ├── AutoLoader.php │ ├── Catalog.php │ ├── Consul.php │ ├── Contract │ │ ├── AgentInterface.php │ │ ├── CatalogInterface.php │ │ ├── HealthInterface.php │ │ ├── KVInterface.php │ │ └── SessionInterface.php │ ├── Exception │ │ ├── ClientException.php │ │ ├── ConsulException.php │ │ └── ServerException.php │ ├── Health.php │ ├── Helper │ │ └── OptionsResolver.php │ ├── KV.php │ ├── Response.php │ └── Session.php └── test │ ├── bootstrap.php │ ├── config │ └── base.php │ ├── testing │ ├── AutoLoader.php │ ├── TestBean.php │ └── bean.php │ └── unit │ ├── AgentTest.php │ ├── CatalogTest.php │ ├── ConsulTest.php │ ├── KVTest.php │ └── OptionsResolverTest.php ├── crontab ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src │ ├── Annotaion │ │ ├── Mapping │ │ │ ├── Cron.php │ │ │ └── Scheduled.php │ │ └── Parser │ │ │ ├── CronParser.php │ │ │ └── ScheduledParser.php │ ├── AutoLoader.php │ ├── Crontab.php │ ├── CrontabContext.php │ ├── CrontabEvent.php │ ├── CrontabExpression.php │ ├── CrontabRegister.php │ ├── Exception │ │ └── CrontabException.php │ ├── Listener │ │ ├── AfterCrontabListener.php │ │ └── BeforeCrontabListener.php │ └── Process │ │ └── CrontabProcess.php └── test │ ├── bootstrap.php │ ├── testing │ ├── AutoLoader.php │ ├── TestCrontab.php │ └── bean.php │ └── unit │ ├── CrontabExpressTest.php │ └── CrontabTest.php ├── devtool ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── commands.inc ├── composer.json ├── phar.build.inc ├── phpunit.xml.dist ├── resource │ ├── image │ │ └── devtool.jpg │ └── template │ │ ├── command.stub │ │ ├── controller-rest.stub │ │ ├── controller.stub │ │ ├── entity.stub │ │ ├── file-header.stub │ │ ├── getter.stub │ │ ├── listener.stub │ │ ├── middleware.stub │ │ ├── migration.stub │ │ ├── override.stub │ │ ├── phpstorm.stub │ │ ├── process.stub │ │ ├── property.stub │ │ ├── setter.stub │ │ ├── task.stub │ │ └── ws-controller.stub ├── src │ ├── Annotation │ │ ├── Mapping │ │ │ └── Migration.php │ │ └── Parser │ │ │ └── MigrationParser.php │ ├── AutoLoader.php │ ├── Command │ │ ├── AppCommand.php │ │ ├── DClientCommand.php │ │ ├── DConfCommand.php │ │ ├── DInfoCommand.php │ │ ├── DToolCommand.php │ │ ├── EntityCommand.php │ │ └── MigrateCommand.php │ ├── Common │ │ └── DevTcpClient.php │ ├── DevTool.php │ ├── FileGenerator.php │ ├── Helper │ │ ├── ConsoleHelper.php │ │ └── DevToolHelper.php │ ├── Http │ │ ├── Controller │ │ │ ├── AppController.php │ │ │ ├── GenController.php │ │ │ ├── HttpController.php │ │ │ ├── RouteController.php │ │ │ ├── RpcController.php │ │ │ └── ServerController.php │ │ └── Middleware │ │ │ └── DevToolMiddleware.php │ ├── Listener │ │ ├── AppInitCompleteListener.php │ │ ├── EventFireListener.php │ │ └── WorkStartListener.php │ ├── Migration │ │ ├── Contract │ │ │ └── MigrationInterface.php │ │ ├── Exception │ │ │ └── MigrationException.php │ │ ├── Migration.php │ │ ├── MigrationManager.php │ │ └── MigrationRegister.php │ ├── Model │ │ ├── Dao │ │ │ ├── MigrateDao.php │ │ │ └── SchemaDao.php │ │ ├── Data │ │ │ ├── MigrateData.php │ │ │ └── SchemaData.php │ │ └── Logic │ │ │ ├── EntityLogic.php │ │ │ ├── MetaLogic.php │ │ │ └── MigrateLogic.php │ └── WebSocket │ │ └── DevToolController.php ├── test │ ├── bootstrap.php │ ├── config │ │ └── define.php │ └── unit │ │ ├── FileGeneratorTest.php │ │ └── res │ │ └── some.stub └── web │ ├── .babelrc │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .postcssrc.js │ ├── README.md │ ├── build │ ├── build.js │ ├── check-versions.js │ ├── logo.png │ ├── utils.js │ ├── vue-loader.conf.js │ ├── webpack.base.conf.js │ ├── webpack.dev.conf.js │ └── webpack.prod.conf.js │ ├── config │ ├── dev.env.js │ ├── index.js │ └── prod.env.js │ ├── dist │ ├── devtool │ │ └── static │ │ │ ├── css │ │ │ ├── app.4b3662307aa5ec3a3c7229fd188dbd59.css │ │ │ └── app.4b3662307aa5ec3a3c7229fd188dbd59.css.map │ │ │ ├── img │ │ │ ├── swoft-favicon-48.ico │ │ │ └── swoft-logo-text.0617d26.png │ │ │ └── js │ │ │ ├── 0.6e5feb53710796ec3b49.js │ │ │ ├── 0.6e5feb53710796ec3b49.js.map │ │ │ ├── 1.204a587c93ce2db59247.js │ │ │ ├── 1.204a587c93ce2db59247.js.map │ │ │ ├── 10.e8178500f2a68e34c250.js │ │ │ ├── 10.e8178500f2a68e34c250.js.map │ │ │ ├── 11.6fb9061b2dd7368a639f.js │ │ │ ├── 11.6fb9061b2dd7368a639f.js.map │ │ │ ├── 12.18a35e70f4e20187c6c2.js │ │ │ ├── 12.18a35e70f4e20187c6c2.js.map │ │ │ ├── 13.042aaf963386062ca1d5.js │ │ │ ├── 13.042aaf963386062ca1d5.js.map │ │ │ ├── 14.41c07fa1a27a4d7271e6.js │ │ │ ├── 14.41c07fa1a27a4d7271e6.js.map │ │ │ ├── 15.652987d5da1c5369ab8e.js │ │ │ ├── 15.652987d5da1c5369ab8e.js.map │ │ │ ├── 16.4faf2ce20a3f7bc1e118.js │ │ │ ├── 16.4faf2ce20a3f7bc1e118.js.map │ │ │ ├── 17.6e64bcd825055eeb8bd3.js │ │ │ ├── 17.6e64bcd825055eeb8bd3.js.map │ │ │ ├── 18.aef9bddd1bf7a4f5dbcb.js │ │ │ ├── 18.aef9bddd1bf7a4f5dbcb.js.map │ │ │ ├── 19.6d9e92bc36b34464c9ec.js │ │ │ ├── 19.6d9e92bc36b34464c9ec.js.map │ │ │ ├── 2.e3bba5ae683cbf916e9e.js │ │ │ ├── 2.e3bba5ae683cbf916e9e.js.map │ │ │ ├── 20.2d637b8e8117eb85c215.js │ │ │ ├── 20.2d637b8e8117eb85c215.js.map │ │ │ ├── 21.ef602ec7a767d5939542.js │ │ │ ├── 21.ef602ec7a767d5939542.js.map │ │ │ ├── 22.42df468cb146dad13ec3.js │ │ │ ├── 22.42df468cb146dad13ec3.js.map │ │ │ ├── 23.07c1314e692d6ed2f0f8.js │ │ │ ├── 23.07c1314e692d6ed2f0f8.js.map │ │ │ ├── 3.78eb1f5934f499999baa.js │ │ │ ├── 3.78eb1f5934f499999baa.js.map │ │ │ ├── 4.3483b76d32a47b64ba63.js │ │ │ ├── 4.3483b76d32a47b64ba63.js.map │ │ │ ├── 5.ba4a72f4b9f693e96e3b.js │ │ │ ├── 5.ba4a72f4b9f693e96e3b.js.map │ │ │ ├── 6.82115885aec0d8e87482.js │ │ │ ├── 6.82115885aec0d8e87482.js.map │ │ │ ├── 7.7cae4405b23623819076.js │ │ │ ├── 7.7cae4405b23623819076.js.map │ │ │ ├── 8.7c8a636950e59b2172d4.js │ │ │ ├── 8.7c8a636950e59b2172d4.js.map │ │ │ ├── 9.2317d8e1a4e548cbde74.js │ │ │ ├── 9.2317d8e1a4e548cbde74.js.map │ │ │ ├── app.0d24c1755835518b0907.js │ │ │ ├── app.0d24c1755835518b0907.js.map │ │ │ ├── manifest.dffd4c171722145f4ae3.js │ │ │ ├── manifest.dffd4c171722145f4ae3.js.map │ │ │ ├── vendor.7342447e388fe08e6aa9.js │ │ │ └── vendor.7342447e388fe08e6aa9.js.map │ └── index.html │ ├── index.html │ ├── package.json │ ├── src │ ├── .gitrepo │ ├── App.vue │ ├── assets │ │ ├── logo.png │ │ ├── style │ │ │ └── common.styl │ │ ├── swoft-favicon-48.ico │ │ ├── swoft-favicon-64.ico │ │ ├── swoft-logo-md.png │ │ ├── swoft-logo-sm.png │ │ └── swoft-logo-text.png │ ├── config.js │ ├── libs │ │ ├── api-services.js │ │ ├── constants.js │ │ ├── http.js │ │ ├── sidebar.js │ │ └── util.js │ ├── locale │ │ ├── index.js │ │ └── lang │ │ │ ├── en-US.js │ │ │ └── zh-CN.js │ ├── main.js │ ├── router │ │ ├── index.js │ │ └── routes.js │ └── views │ │ ├── Dashboard.vue │ │ ├── HelloWorld.vue │ │ ├── app │ │ ├── AopHandlers.vue │ │ ├── AppBeans.vue │ │ ├── AppComponents.vue │ │ ├── AppConfig.vue │ │ ├── AppEvents.vue │ │ ├── AppInfo.vue │ │ ├── AppLog.vue │ │ ├── ConnectionPools.vue │ │ └── RunTrace.vue │ │ ├── gen │ │ └── ClassGen.vue │ │ ├── http │ │ ├── HttpMiddleware.vue │ │ └── HttpRoutes.vue │ │ ├── pages │ │ └── About.vue │ │ ├── parts │ │ ├── AppFooter.vue │ │ ├── NProgress.vue │ │ ├── PageSearch.vue │ │ └── SimpleTable.vue │ │ ├── rpc │ │ ├── RpcMiddleware.vue │ │ └── RpcRoutes.vue │ │ ├── server │ │ ├── ServerConfig.vue │ │ ├── ServerEvents.vue │ │ ├── ServerInfo.vue │ │ ├── ServerStats.vue │ │ └── SwooleLog.vue │ │ └── ws │ │ ├── WsRoutes.vue │ │ └── WsTest.vue │ └── static │ ├── .gitkeep │ └── img │ └── swoft-favicon-48.ico ├── elasticsearch ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── LICENSE ├── README.md ├── composer.json └── src │ ├── AutoLoader.php │ ├── Client.php │ ├── Connection │ ├── Connection.php │ ├── ConnectionInstance.php │ └── ConnectionManager.php │ ├── Elasticsearch.php │ ├── Eloquent │ ├── Builder.php │ ├── Collection.php │ └── Model.php │ ├── Exception │ └── ElasticsearchException.php │ ├── Listener │ ├── CoroutineDeferListener.php │ ├── CoroutineDestroyListener.php │ ├── WorkerStartListener.php │ └── WorkerStopAndErrorListener.php │ └── Pool.php ├── grpc ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── LICENSE ├── README.md └── composer.json ├── kafka ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── LICENSE ├── README.md └── composer.json ├── limiter ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src │ ├── Annotation │ │ ├── Mapping │ │ │ └── RateLimiter.php │ │ └── Parser │ │ │ └── RateLimiterParser.php │ ├── Aspect │ │ └── LimiterAspect.php │ ├── AutoLoader.php │ ├── Contract │ │ └── RateLimiterInterface.php │ ├── Exception │ │ └── RateLImiterException.php │ ├── Rate │ │ ├── AbstractRateLimiter.php │ │ └── RedisRateLimiter.php │ ├── RateLimiterRegister.php │ └── RateLimter.php └── test │ ├── bootstrap.php │ ├── config │ └── base.php │ ├── testing │ ├── AutoLoader.php │ ├── KeyHelper.php │ ├── RateLimiterBean.php │ └── bean.php │ └── unit │ └── RateLimiterTest.php ├── session ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src │ ├── AutoLoader.php │ ├── Concern │ │ └── AbstractHandler.php │ ├── Contract │ │ ├── SessionHandlerInterface.php │ │ └── SessionIdInterface.php │ ├── Handler │ │ ├── ArrayHandler.php │ │ ├── CoFileHandler.php │ │ ├── EmptyHandler.php │ │ ├── FileHandler.php │ │ ├── MemTableHandler.php │ │ ├── MysqlHandler.php │ │ └── RedisHandler.php │ ├── HttpSession.php │ ├── Listener │ │ └── PipeMessageListener.php │ ├── SessionManager.php │ └── SessionMiddleware.php └── test │ └── bootstrap.php ├── swagger ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src │ ├── Annotation │ │ ├── Mapping │ │ │ ├── ApiContact.php │ │ │ ├── ApiInfo.php │ │ │ ├── ApiLicense.php │ │ │ ├── ApiOperation.php │ │ │ ├── ApiProperty.php │ │ │ ├── ApiPropertyEntity.php │ │ │ ├── ApiPropertySchema.php │ │ │ ├── ApiRequestBody.php │ │ │ ├── ApiResponse.php │ │ │ ├── ApiSchema.php │ │ │ └── ApiServer.php │ │ └── Parser │ │ │ ├── ApiContractParser.php │ │ │ ├── ApiEntityParser.php │ │ │ ├── ApiInfoParser.php │ │ │ ├── ApiLicenseParser.php │ │ │ ├── ApiOperationParser.php │ │ │ ├── ApiPropertyEntityParser.php │ │ │ ├── ApiPropertyParser.php │ │ │ ├── ApiPropertySchemaParser.php │ │ │ ├── ApiRequestBodyParser.php │ │ │ ├── ApiResponseParser.php │ │ │ ├── ApiSchemaParser.php │ │ │ └── ApiServerParser.php │ ├── ApiRegister.php │ ├── Autoloader.php │ ├── Command │ │ └── SwaggerCommand.php │ ├── ContentType.php │ ├── Contract │ │ └── DtoInterface.php │ ├── Dto.php │ ├── Dto │ │ └── JsonDto.php │ ├── Exception │ │ ├── DtoException.php │ │ └── SwaggerException.php │ ├── Node │ │ ├── Components.php │ │ ├── Contact.php │ │ ├── Header.php │ │ ├── Info.php │ │ ├── License.php │ │ ├── MediaType.php │ │ ├── Node.php │ │ ├── OpenApi.php │ │ ├── Operation.php │ │ ├── Parameter.php │ │ ├── PathItem.php │ │ ├── Paths.php │ │ ├── Property.php │ │ ├── RequestBody.php │ │ ├── Response.php │ │ ├── Responses.php │ │ ├── Schema.php │ │ ├── Server.php │ │ └── ServerVariable.php │ ├── Schema.php │ └── Swagger.php └── test │ ├── bootstrap.php │ ├── testing │ ├── Application.php │ ├── Autoloader.php │ ├── Entity │ │ └── User.php │ ├── Schema │ │ ├── IndexData.php │ │ ├── IndexOther.php │ │ ├── IndexRequestSchema.php │ │ ├── IndexResponseSchema.php │ │ └── ResponseSchema.php │ ├── SwgController.php │ ├── Validator │ │ ├── TestValidator.php │ │ └── TestValidator2.php │ └── bean.php │ └── unit │ └── SwgTest.php ├── swoole-tracker ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src │ ├── AutoLoader.php │ ├── Middleware │ │ └── SwooleTrackerMiddleware.php │ └── SwooleTracker.php └── test │ ├── bootstrap.php │ └── unit │ └── SwooleTrackerTest.php ├── view ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src │ ├── Annotation │ │ ├── Mapping │ │ │ └── View.php │ │ └── Parser │ │ │ └── ViewParser.php │ ├── AutoLoader.php │ ├── Contract │ │ └── ViewInterface.php │ ├── Helper │ │ └── Functions.php │ ├── Middleware │ │ └── ViewMiddleware.php │ ├── Renderer.php │ └── ViewRegister.php └── test │ ├── bootstrap.php │ ├── fixture │ └── layout.php │ └── unit │ └── RendererTest.php ├── whoops ├── .github │ ├── ISSUE_TEMPLATE │ │ └── config.yml │ ├── PULL_REQUEST_TEMPLATE.md │ └── workflows │ │ ├── php.yml │ │ └── release.yml ├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── phpunit.xml ├── src │ ├── AutoLoader.php │ ├── WhoopsHandler.php │ └── WhoopsMiddleware.php └── test │ ├── bootstrap.php │ ├── testing │ └── Whoops.php │ └── unit │ └── WhoopsTest.php └── zipkin ├── .github ├── ISSUE_TEMPLATE │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── php.yml │ └── release.yml ├── LICENSE ├── README.md └── composer.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | # 对所有文件生效 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 4 8 | end_of_line = lf 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | # 对后缀名为 md 的文件生效 13 | [*.md] 14 | trim_trailing_whitespace = false 15 | 16 | [*.html] 17 | indent_size = 2 18 | 19 | [*.json] 20 | indent_size = 2 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 18 | 19 | ### What does this PR do? 20 | 21 | 22 | 23 | 24 | ### Motivation 25 | 26 | 27 | 28 | 29 | ### More 30 | 31 | - [ ] Added/updated tests 32 | - [ ] Added/updated documentation 33 | 34 | ### Additional Notes 35 | 36 | 37 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: composer 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .settings/ 3 | .phpintel/ 4 | .project 5 | .idea/ 6 | .git/ 7 | runtime/ 8 | vendor/ 9 | test/coverages/ 10 | .env 11 | .DS_Store 12 | *.cache 13 | *.patch 14 | *.lock -------------------------------------------------------------------------------- /.php-cs-fixer.php: -------------------------------------------------------------------------------- 1 | true, 14 | 'array_syntax' => [ 15 | 'syntax' => 'short' 16 | ], 17 | 'list_syntax' => [ 18 | 'syntax' => 'short' 19 | ], 20 | 'class_attributes_separation' => true, 21 | 'declare_strict_types' => true, 22 | 'global_namespace_import' => [ 23 | 'import_constants' => true, 24 | 'import_functions' => true, 25 | ], 26 | 'header_comment' => [ 27 | 'comment_type' => 'PHPDoc', 28 | 'header' => $header, 29 | 'separate' => 'bottom' 30 | ], 31 | 'no_unused_imports' => true, 32 | 'single_quote' => true, 33 | 'standardize_not_equals' => true, 34 | 'void_return' => true, // add :void for method 35 | ]; 36 | 37 | return (new PhpCsFixer\Config) 38 | ->setRiskyAllowed(true) 39 | ->setRules($rules) 40 | ->setFinder( 41 | PhpCsFixer\Finder::create() 42 | ->exclude('test') 43 | ->exclude('runtime') 44 | ->exclude('vendor') 45 | ->in(__DIR__) 46 | ) 47 | ->setUsingCache(false); 48 | -------------------------------------------------------------------------------- /README.zh-CN.md: -------------------------------------------------------------------------------- 1 | # Swoft Ext Component 2 | 3 | 这里是swoft扩展组件开发仓库 4 | 5 | ## [English](README.md) 6 | 7 | ## 参与贡献 8 | 9 | 开发组非常欢迎各位向我们提交PR(_Pull Request_),但是为了保证代码质量和统一的风格,向官方的主仓库 [swoft/swoft](https://github.com/swoft-cloud/swoft) 和 开发仓库贡献代码时需要注意代码和commit格式 10 | 11 | ### 发起PR时的注意事项 12 | 13 | - 请不要提交PR到各个组件子仓库,它们都是 **只读的** 14 | - 核心组件的 _开发仓库_ 是 **[swoft/swoft-component][core]** 15 | - 扩展组件的 _开发仓库_ 是 **[swoft/swoft-ext][ext]** 16 | - 请 `fork` 对应的开发仓库,修改后,请把你的PR提交到对应的开发仓库 17 | 18 | > 发布版本时官方会将代码同步到各个子仓库 19 | 20 | ### Commit Message 21 | 22 | - commit message 只能是英文信息 23 | - 请尽量保证commit message是有意义的说明 24 | - 最好以 `add:` `update:` `fix:` 等关键字开头 25 | 26 | ### 代码风格 27 | 28 | - 提交的PHP代码 **必须** 遵循 PSR-2 代码风格 29 | - 合理且有意义的类、方法、变量命名 30 | - 适当的注释,合理的使用空行保持代码的简洁,易于阅读 31 | - 不要包含一些无意义的信息 例如 `@author` 等(_提交者是能够从commit log里看到的_) 32 | 33 | 34 | [core]: https://github.com/swoft-cloud/swoft-component 35 | [ext]: https://github.com/swoft-cloud/swoft-ext 36 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # TODO 2 | 3 | - [ ] jwt auth 4 | - [ ] auth manager 5 | - [x] whoops 6 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | ./test/unit 17 | 18 | 19 | 20 | 21 | ./src/* 22 | 23 | 24 | -------------------------------------------------------------------------------- /script/subtree-add.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # add repo to the component 4 | # usage: ./subtree-add.sh http-server 5 | # 6 | 7 | binName="bash $(basename $0)" 8 | 9 | if [[ -z "$1" ]]; then 10 | echo -e "Usage: $binName PROJECT_NAME\n" 11 | echo "Example:" 12 | echo " $binName http-server" 13 | exit 14 | fi 15 | 16 | REPO=$1 17 | 18 | set -ex 19 | 20 | # run command 21 | git subtree add --prefix=src/${REPO} git@github.com:swoft-cloud/swoft-${REPO}.git master --squash 22 | -------------------------------------------------------------------------------- /script/subtree-pull.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | REPOS=$(ls src/) 6 | TARGET_BRANCH=master 7 | 8 | echo "Update code to latest" 9 | echo "> git pull --no-edit" 10 | git pull --no-edit 11 | 12 | echo "Will pushed projects:" 13 | echo ${REPOS} 14 | 15 | # git subtree push --prefix=src/annotation git@github.com:swoft-cloud/swoft-annotation.git master --squash 16 | for lbName in ${REPOS} ; do 17 | echo "" 18 | echo "======> Push the project:【${lbName}】" 19 | echo "> git subtree pull --prefix=src/${lbName} git@github.com:swoft-cloud/swoft-${lbName}.git ${TARGET_BRANCH} --squash" 20 | git subtree pull --prefix=src/${lbName} git@github.com:swoft-cloud/swoft-${lbName}.git ${TARGET_BRANCH} --squash 21 | done 22 | 23 | echo "" 24 | echo "Push Completed!" 25 | -------------------------------------------------------------------------------- /script/subtree-push.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | REPOS=$(ls src/) 6 | TARGET_BRANCH=master 7 | 8 | echo "Update code to latest" 9 | echo "> git pull --no-edit" 10 | git pull --no-edit 11 | 12 | echo "Will pushed projects:" 13 | echo ${REPOS} 14 | 15 | # git subtree push --prefix=src/annotation git@github.com:swoft-cloud/swoft-annotation.git master --squash 16 | for lbName in ${REPOS} ; do 17 | echo "" 18 | echo "======> Push the project:【${lbName}】" 19 | echo "> git subtree push --prefix=src/${lbName} git@github.com:swoft-cloud/swoft-${lbName}.git ${TARGET_BRANCH} --squash" 20 | git subtree push --prefix=src/${lbName} git@github.com:swoft-cloud/swoft-${lbName}.git ${TARGET_BRANCH} --squash 21 | done 22 | 23 | echo "" 24 | echo "Push Completed!" 25 | -------------------------------------------------------------------------------- /script/subtree-split.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | git subtree split -P ../src/${1} -b ${1} \ 4 | && cd /tmp/ \ 5 | && mkdir ${1} \ 6 | && cd ${1} \ 7 | && git init \ 8 | && git remote add origin git@github.com:swoft-cloud/swoft-${1}.git \ 9 | && git pull /data/www/swoft/component/ ${1} \ 10 | && git push origin -f master 11 | -------------------------------------------------------------------------------- /script/template/README.tpl: -------------------------------------------------------------------------------- 1 | # Swoft {{componentUpWord}} 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/{{component}}.svg)](https://packagist.org/packages/swoft/{{component}}) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft {{componentUpWord}} Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/{{component}} 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/amqp/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/amqp/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | composer.lock -------------------------------------------------------------------------------- /src/amqp/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Amqp 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/amqp.svg)](https://packagist.org/packages/swoft/amqp) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Amqp Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/amqp 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/amqp/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/amqp", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft" 9 | ], 10 | "description": "micro-service framework base on swoole", 11 | "license": "Apache-2.0", 12 | "require": { 13 | "php": ">7.1", 14 | "php-amqplib/php-amqplib": "^2.9", 15 | "swoft/connection-pool": "~2.0.0", 16 | "swoft/stdlib": "~2.0.0" 17 | }, 18 | "autoload": { 19 | "psr-4": { 20 | "Swoft\\Amqp\\": "src/" 21 | } 22 | }, 23 | "require-dev": { 24 | "phpunit/phpunit": "^7.5" 25 | }, 26 | "autoload-dev": { 27 | "psr-4": { 28 | "SwoftTest\\Amqp\\Unit\\": "test/unit/", 29 | "SwoftTest\\Amqp\\Testing\\": "test/testing/" 30 | } 31 | }, 32 | "scripts": { 33 | "test": "./vendor/bin/phpunit -c phpunit.xml" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/amqp/src/Connection/SSLConnection.php: -------------------------------------------------------------------------------- 1 | 7.1", 14 | "swoft/stdlib": "~2.0.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Swoft\\Apollo\\": "src/" 19 | } 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "^7.5" 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "SwoftTest\\Apollo\\Unit\\": "test/unit/", 27 | "SwoftTest\\Apollo\\Testing\\": "test/testing/" 28 | } 29 | }, 30 | "repositories": { 31 | }, 32 | "scripts": { 33 | "test": "./vendor/bin/phpunit -c phpunit.xml" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/apollo/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./test/unit 15 | 16 | 17 | 18 | 19 | ./src/* 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/apollo/src/Exception/ApolloException.php: -------------------------------------------------------------------------------- 1 | __DIR__, 25 | ]; 26 | } 27 | 28 | /** 29 | * @return array 30 | */ 31 | public function metadata(): array 32 | { 33 | return []; 34 | } 35 | } -------------------------------------------------------------------------------- /src/apollo/test/testing/bean.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'host' => '192.168.2.102', 5 | 'timeout' => -1 6 | ] 7 | ]; -------------------------------------------------------------------------------- /src/breaker/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/breaker/.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .settings/ 3 | .project 4 | *.patch 5 | .idea/ 6 | .git/ 7 | runtime/ 8 | vendor/ 9 | temp/ 10 | *.lock 11 | .phpintel/ 12 | .env 13 | .DS_Store 14 | public/devtool/ -------------------------------------------------------------------------------- /src/breaker/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.1 5 | - 7.2 6 | - 7.3 7 | 8 | before_script: 9 | - composer config -g process-timeout 900 && composer update 10 | - phpenv config-rm xdebug.ini 11 | 12 | script: 13 | - composer test -------------------------------------------------------------------------------- /src/breaker/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Breaker 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/breaker.svg)](https://packagist.org/packages/swoft/breaker) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Breaker Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/breaker 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/breaker/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/breaker", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft" 9 | ], 10 | "description": "micro-service framework base on swoole", 11 | "license": "Apache-2.0", 12 | "require": { 13 | "php": ">7.1", 14 | "swoft/stdlib": "~2.0.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Swoft\\Breaker\\": "src/" 19 | } 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "^7.5" 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "SwoftTest\\Breaker\\Unit\\": "test/unit/", 27 | "SwoftTest\\Breaker\\Testing\\": "test/testing/" 28 | } 29 | }, 30 | "repositories": { 31 | }, 32 | "scripts": { 33 | "test": "./vendor/bin/phpunit -c phpunit.xml" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/breaker/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./test/unit 15 | 16 | 17 | 18 | 19 | ./src/* 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/breaker/src/Annotation/Parser/BreakerParser.php: -------------------------------------------------------------------------------- 1 | className, $this->methodName, $annotationObject); 42 | return []; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/breaker/src/AutoLoader.php: -------------------------------------------------------------------------------- 1 | __DIR__, 32 | ]; 33 | } 34 | 35 | /** 36 | * @return array 37 | */ 38 | public function metadata(): array 39 | { 40 | $jsonFile = dirname(__DIR__) . '/composer.json'; 41 | 42 | return ComposerJSON::open($jsonFile)->getMetadata(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/breaker/src/Contract/StateInterface.php: -------------------------------------------------------------------------------- 1 | breakerManger->initBreaker($breakers); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/breaker/src/State/CloseState.php: -------------------------------------------------------------------------------- 1 | breaker->resetFailCount(); 30 | } 31 | 32 | /** 33 | * Success 34 | */ 35 | public function success(): void 36 | { 37 | // Reset failCount 38 | $this->breaker->resetFailCount(); 39 | return; 40 | } 41 | 42 | /** 43 | */ 44 | public function exception(): void 45 | { 46 | parent::exception(); 47 | 48 | if ($this->breaker->isReachFailThreshold()) { 49 | $this->breaker->moveToOpen(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/breaker/src/State/OpenState.php: -------------------------------------------------------------------------------- 1 | breaker->isOpen()) { 32 | throw new BreakerException('Breaker is opened!'); 33 | } 34 | } 35 | 36 | /** 37 | * Exception 38 | */ 39 | public function exception(): void 40 | { 41 | return; 42 | } 43 | 44 | /** 45 | * Reset 46 | */ 47 | public function reset(): void 48 | { 49 | $retryTime = $this->breaker->getRetryTime(); 50 | Timer::after($retryTime * 1000, function (): void { 51 | $this->breaker->moveToHalfOpen(); 52 | }); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/breaker/test/config/base.php: -------------------------------------------------------------------------------- 1 | __DIR__, 25 | ]; 26 | } 27 | 28 | /** 29 | * @return array 30 | */ 31 | public function metadata(): array 32 | { 33 | return []; 34 | } 35 | } -------------------------------------------------------------------------------- /src/breaker/test/testing/bean.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'timeout' => 3, 5 | ] 6 | ]; -------------------------------------------------------------------------------- /src/consul/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/consul/.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .settings/ 3 | .project 4 | *.patch 5 | .idea/ 6 | .git/ 7 | runtime/ 8 | vendor/ 9 | temp/ 10 | *.lock 11 | .phpintel/ 12 | .env 13 | .DS_Store 14 | public/devtool/ -------------------------------------------------------------------------------- /src/consul/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.1 5 | - 7.2 6 | - 7.3 7 | 8 | before_script: 9 | - composer config -g process-timeout 900 && composer update 10 | - phpenv config-rm xdebug.ini 11 | 12 | script: 13 | - composer test -------------------------------------------------------------------------------- /src/consul/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Consul 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/consul.svg)](https://packagist.org/packages/swoft/consul) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Consul Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/consul 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/consul/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/consul", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft" 9 | ], 10 | "description": "micro-service framework base on swoole", 11 | "license": "Apache-2.0", 12 | "require": { 13 | "php": ">7.1", 14 | "swoft/stdlib": "~2.0.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Swoft\\Consul\\": "src/" 19 | } 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "^7.5" 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "SwoftTest\\Consul\\Unit\\": "test/unit/", 27 | "SwoftTest\\Consul\\Testing\\": "test/testing/" 28 | } 29 | }, 30 | "repositories": { 31 | }, 32 | "scripts": { 33 | "test": "./vendor/bin/phpunit -c phpunit.xml" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/consul/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./test/unit 15 | 16 | 17 | 18 | 19 | ./src/* 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/consul/src/AutoLoader.php: -------------------------------------------------------------------------------- 1 | __DIR__, 32 | ]; 33 | } 34 | 35 | /** 36 | * @return array 37 | */ 38 | public function metadata(): array 39 | { 40 | $jsonFile = dirname(__DIR__) . '/composer.json'; 41 | 42 | return ComposerJSON::open($jsonFile)->getMetadata(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/consul/src/Contract/HealthInterface.php: -------------------------------------------------------------------------------- 1 | __DIR__, 25 | ]; 26 | } 27 | 28 | /** 29 | * @return array 30 | */ 31 | public function metadata(): array 32 | { 33 | return []; 34 | } 35 | } -------------------------------------------------------------------------------- /src/consul/test/testing/TestBean.php: -------------------------------------------------------------------------------- 1 | [ 4 | 'host' => '192.168.4.11' 5 | ] 6 | ]; -------------------------------------------------------------------------------- /src/consul/test/unit/ConsulTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 19 | } 20 | } -------------------------------------------------------------------------------- /src/consul/test/unit/OptionsResolverTest.php: -------------------------------------------------------------------------------- 1 | 'bar', 21 | 'hello' => 'world', 22 | 'baz' => 'inga', 23 | ]; 24 | 25 | $availableOptions = [ 26 | 'foo', 27 | 'baz', 28 | ]; 29 | 30 | $result = OptionsResolver::resolve($options, $availableOptions); 31 | 32 | $expected = [ 33 | 'foo' => 'bar', 34 | 'baz' => 'inga', 35 | ]; 36 | 37 | $this->assertSame($expected, $result); 38 | } 39 | 40 | public function testResolveWithoutMatchingOptions() 41 | { 42 | $options = [ 43 | 'hello' => 'world', 44 | ]; 45 | 46 | $availableOptions = [ 47 | 'foo', 48 | 'baz', 49 | ]; 50 | 51 | $result = OptionsResolver::resolve($options, $availableOptions); 52 | $this->assertSame([], $result); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/crontab/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/crontab/.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .settings/ 3 | .project 4 | *.patch 5 | .idea/ 6 | .git/ 7 | runtime/ 8 | vendor/ 9 | *.lock 10 | .phpintel/ 11 | .env 12 | .phpstorm.meta.php 13 | .DS_Store 14 | public/devtool/ 15 | -------------------------------------------------------------------------------- /src/crontab/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Crontab 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/crontab.svg)](https://packagist.org/packages/swoft/crontab) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Crontab Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/crontab 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/crontab/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/crontab", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft", 9 | "crontab" 10 | ], 11 | "description": "Crontab component for swoft", 12 | "license": "Apache-2.0", 13 | "require": { 14 | "php": ">7.1", 15 | "swoft/framework": "~2.0.0", 16 | "swoft/process": "~2.0.0" 17 | }, 18 | "autoload": { 19 | "classmap": [ 20 | ], 21 | "psr-4": { 22 | "Swoft\\Crontab\\": "src/" 23 | }, 24 | "files": [ 25 | ] 26 | }, 27 | "require-dev": { 28 | "phpunit/phpunit": "^7.5" 29 | }, 30 | "autoload-dev": { 31 | "psr-4": { 32 | "SwoftTest\\Crontab\\Unit\\": "test/unit", 33 | "SwoftTest\\Crontab\\Testing\\": "test/testing" 34 | } 35 | }, 36 | "scripts": { 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/crontab/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./test/unit 15 | 16 | 17 | 18 | 19 | ./src/* 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/crontab/src/Annotaion/Mapping/Cron.php: -------------------------------------------------------------------------------- 1 | value = $values['value']; 40 | } 41 | } 42 | 43 | /** 44 | * @return string 45 | */ 46 | public function getValue(): string 47 | { 48 | return $this->value; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/crontab/src/Annotaion/Mapping/Scheduled.php: -------------------------------------------------------------------------------- 1 | name = $values['value']; 40 | } 41 | if (isset($values['name'])) { 42 | $this->name = $values['name']; 43 | } 44 | } 45 | 46 | /** 47 | * @return string 48 | */ 49 | public function getName(): string 50 | { 51 | return $this->name; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/crontab/src/Annotaion/Parser/CronParser.php: -------------------------------------------------------------------------------- 1 | className, $this->methodName, $annotation); 38 | 39 | return []; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/crontab/src/Annotaion/Parser/ScheduledParser.php: -------------------------------------------------------------------------------- 1 | className; 37 | $name = $annotationObject->getName(); 38 | 39 | if (!empty($name)) { 40 | $beanName = $name; 41 | } 42 | 43 | CrontabRegister::registerScheduled($this->className, $beanName); 44 | return [$beanName, $this->className, Bean::SINGLETON, '']; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/crontab/src/AutoLoader.php: -------------------------------------------------------------------------------- 1 | __DIR__, 32 | ]; 33 | } 34 | 35 | /** 36 | * @return array 37 | */ 38 | public function metadata(): array 39 | { 40 | $jsonFile = dirname(__DIR__) . '/composer.json'; 41 | 42 | return ComposerJSON::open($jsonFile)->getMetadata(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/crontab/src/CrontabEvent.php: -------------------------------------------------------------------------------- 1 | crontab->tick(); 42 | 43 | // Exe task 44 | $this->crontab->dispatch(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/crontab/test/testing/AutoLoader.php: -------------------------------------------------------------------------------- 1 | __DIR__, 25 | ]; 26 | } 27 | 28 | /** 29 | * @return array 30 | */ 31 | public function metadata(): array 32 | { 33 | return []; 34 | } 35 | } -------------------------------------------------------------------------------- /src/crontab/test/testing/TestCrontab.php: -------------------------------------------------------------------------------- 1 | test = "method"; 31 | } 32 | 33 | /** 34 | * @return string 35 | */ 36 | public function getTest(): string 37 | { 38 | return $this->test; 39 | } 40 | } -------------------------------------------------------------------------------- /src/crontab/test/testing/bean.php: -------------------------------------------------------------------------------- 1 | execute("testCrontab", "method"); 28 | 29 | /* @var TestCrontab $testCrontab */ 30 | $testCrontab = BeanFactory::getBean("testCrontab"); 31 | $testResult = $testCrontab->getTest(); 32 | 33 | $this->assertEquals('method', $testResult); 34 | } 35 | } -------------------------------------------------------------------------------- /src/devtool/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/devtool/.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .settings/ 3 | .project 4 | *.patch 5 | .idea/ 6 | .git/ 7 | runtime/ 8 | vendor/ 9 | temp/ 10 | *.lock 11 | .phpintel/ 12 | .DS_Store -------------------------------------------------------------------------------- /src/devtool/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.1 5 | - 7.2 6 | - 7.3 7 | 8 | before_script: 9 | - composer config -g process-timeout 9000 && composer update 10 | - phpenv config-rm xdebug.ini 11 | - yes no | pecl install swoole-4.3.4 12 | 13 | script: 14 | - php --ri swoole 15 | - composer test 16 | -------------------------------------------------------------------------------- /src/devtool/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Devtool 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/devtool.svg)](https://packagist.org/packages/swoft/devtool) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Devtool Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/devtool 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/devtool/commands.inc: -------------------------------------------------------------------------------- 1 | [ 5 | // if has args. 6 | [ 7 | // arg0, arg1 8 | ], 9 | 'srcDir' => '@vendor/swoft/devtool/web/dist/devtool', 10 | 'dstDir' => '@base/public', 11 | ], 12 | ]; 13 | -------------------------------------------------------------------------------- /src/devtool/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/devtool", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft", 9 | "debug", 10 | "devtool" 11 | ], 12 | "description": "Devtool for swoft framework", 13 | "license": "Apache-2.0", 14 | "require": { 15 | "text/template": "~2.6" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "Swoft\\Devtool\\": "src/" 20 | } 21 | }, 22 | "autoload-dev": { 23 | "psr-4": { 24 | "SwoftTest\\Devtool\\Unit\\": "test/unit", 25 | "SwoftTest\\Devtool\\Testing\\": "test/testing" 26 | } 27 | }, 28 | "require-dev": { 29 | "phpunit/phpunit": "^7.5" 30 | }, 31 | "scripts": { 32 | "test": "./vendor/bin/phpunit", 33 | "post-package-update": "echo 'Please rerun command: php bin/swoft dev:publish swoft/devtool -f'" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/devtool/phar.build.inc: -------------------------------------------------------------------------------- 1 | stripComments(true) 14 | ->setShebang(true) 15 | ->addExclude([ 16 | 'test', 17 | ]) 18 | ->addFile([ 19 | 'LICENSE', 20 | 'composer.json', 21 | 'README.md', 22 | 'tests/bootstrap.php', 23 | ]) 24 | ->setCliIndex('bin/devtool') 25 | // ->setWebIndex('web/index.php') 26 | // ->setVersionFile('config/config.php') 27 | ; 28 | 29 | // Console 下的 Command Controller 命令类不去除注释,注释上是命令帮助信息 30 | $compiler->setStripFilter(function ($file) { 31 | /** @var \SplFileInfo $file */ 32 | $path = $file->getPath(); 33 | 34 | if (strpos($path, 'swoft')) { 35 | return false; 36 | } 37 | 38 | return false === strpos($file->getFilename(), 'Command.php'); 39 | }); 40 | -------------------------------------------------------------------------------- /src/devtool/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | test/case 14 | 15 | 16 | 17 | 18 | src 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/devtool/resource/image/devtool.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/resource/image/devtool.jpg -------------------------------------------------------------------------------- /src/devtool/resource/template/command.stub: -------------------------------------------------------------------------------- 1 | use color) 25 | * @Example {= commandVar} FIRST SECOND --opt VALUE -s 26 | * @param Input $input 27 | * @param Output $output 28 | * @return int 29 | */ 30 | public function demo(Input $input, Output $output): int 31 | { 32 | // some logic ... 33 | $output->writeln('hello, this is ' . __METHOD__); 34 | 35 | return 0; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/devtool/resource/template/controller.stub: -------------------------------------------------------------------------------- 1 | {= property}; 8 | } 9 | -------------------------------------------------------------------------------- /src/devtool/resource/template/listener.stub: -------------------------------------------------------------------------------- 1 | getParams()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/devtool/resource/template/middleware.stub: -------------------------------------------------------------------------------- 1 | handle($request); 29 | 30 | // after request handle 31 | 32 | return $response->withAddedHeader('User-Middleware', 'success'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/devtool/resource/template/migration.stub: -------------------------------------------------------------------------------- 1 | getPname(); 22 | $processName = "$pname myProcess process"; 23 | $process->name($processName); 24 | 25 | echo sprintf("Custom child process, Coroutine-id: %s \n", Coroutine::id()); 26 | } 27 | 28 | public function check(): bool 29 | { 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/devtool/resource/template/property.stub: -------------------------------------------------------------------------------- 1 | /** 2 | * {= comment | raw} 3 | {= id} 4 | * @Column({= columnDetail | raw}) 5 | * 6 | * @var {= type} 7 | */ 8 | private {= propertyName}; 9 | -------------------------------------------------------------------------------- /src/devtool/resource/template/setter.stub: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {= paramType} {= paramName} 3 | * 4 | * @return self 5 | */ 6 | public function {= methodName}({= type} {= paramName}): self 7 | { 8 | $this->{= property} = {= paramName}; 9 | 10 | return $this; 11 | } 12 | -------------------------------------------------------------------------------- /src/devtool/resource/template/task.stub: -------------------------------------------------------------------------------- 1 | isDaemonize()) { 35 | // ConsoleUtil::log($msg, $data, $type, [ 36 | // 'DevTool', 37 | // 'WorkerId' => App::getWorkerId(), 38 | // 'CoId' => Coroutine::tid() 39 | // ]); 40 | // } 41 | 42 | // if ($logger = App::getLogger()) { 43 | // $logger->log($type, $msg, $data); 44 | // } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/devtool/src/Listener/EventFireListener.php: -------------------------------------------------------------------------------- 1 | logEventToConsole) { 37 | return; 38 | } 39 | 40 | CLog::info('Trigger event %s', $event->getName()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/devtool/src/Migration/Contract/MigrationInterface.php: -------------------------------------------------------------------------------- 1 | waitExecuteSql; 39 | } 40 | 41 | /** 42 | * proxy execute sql 43 | * 44 | * @param string $sql 45 | */ 46 | protected function execute(string $sql): void 47 | { 48 | $this->waitExecuteSql[] = $sql; 49 | } 50 | 51 | /** 52 | * @param Builder $schema 53 | */ 54 | public function setSchema(Builder $schema): void 55 | { 56 | $this->schema = $schema; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/devtool/test/config/define.php: -------------------------------------------------------------------------------- 1 | '/path', 20 | 'className' => 'DemoController', 21 | 'namespace' => 'App\Controller', 22 | ]; 23 | 24 | $gen = new FileGenerator([ 25 | 'tplDir' => __DIR__ . '/res', 26 | ]); 27 | 28 | $code = $gen->setTplFilename('some')->render($data); 29 | 30 | $this->assertTrue(\strpos($code, $data['prefix']) > 0); 31 | $this->assertTrue(\strpos($code, $data['className']) > 0); 32 | $this->assertTrue(\strpos($code, $data['namespace']) > 0); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/devtool/test/unit/res/some.stub: -------------------------------------------------------------------------------- 1 | 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime", ["transform-imports", { 12 | "vuetify": { 13 | "transform": "vuetify/es5/components/${member}", 14 | "preventFullImport": true 15 | } 16 | }]] 17 | } 18 | -------------------------------------------------------------------------------- /src/devtool/web/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /src/devtool/web/.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | -------------------------------------------------------------------------------- /src/devtool/web/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: true, 11 | }, 12 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 13 | extends: 'standard', 14 | // required to lint *.vue files 15 | plugins: [ 16 | 'html' 17 | ], 18 | // add your custom rules here 19 | rules: { 20 | "space-before-function-paren": 0, 21 | 22 | // allow async-await 23 | 'generator-star-spacing': 'off', 24 | // allow debugger during development 25 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/devtool/web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | npm-debug.log* 4 | yarn-debug.log* 5 | yarn-error.log* 6 | 7 | # Editor directories and files 8 | .idea 9 | .vscode 10 | *.suo 11 | *.ntvs* 12 | *.njsproj 13 | *.sln 14 | -------------------------------------------------------------------------------- /src/devtool/web/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/devtool/web/README.md: -------------------------------------------------------------------------------- 1 | # devtool 2 | 3 | > A Vue.js project 4 | 5 | ## 一些改动 6 | 7 | 文件 `vendor/swoft/devtool/web/config/index.js` 8 | 9 | - 增加了开发时的代理配置 10 | 11 | ```json 12 | proxyTable: { 13 | '/api': { 14 | target: 'http://127.0.0.1:9088', 15 | pathRewrite: {'^/api': '/__devtool'}, 16 | changeOrigin: true 17 | } 18 | } 19 | ``` 20 | 21 | - 资源发布目录做了调整: `./static` -> `./devtool/static` 22 | 23 | 方便打包后直接拷贝到项目目录的 public 目录下 24 | 25 | - 如果想使用本地字体 `npm install material-design-icons -S` 26 | 27 | ## Build Setup 28 | 29 | ``` bash 30 | # install dependencies 31 | npm install 32 | 33 | # serve with hot reload at localhost:8080 34 | npm run dev 35 | 36 | # build for production with minification 37 | npm run build 38 | 39 | # build for production and view the bundle analyzer report 40 | npm run build --report 41 | ``` 42 | 43 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 44 | -------------------------------------------------------------------------------- /src/devtool/web/build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /src/devtool/web/build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/build/logo.png -------------------------------------------------------------------------------- /src/devtool/web/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/devtool/web/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /src/devtool/web/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /src/devtool/web/dist/devtool/static/img/swoft-favicon-48.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/dist/devtool/static/img/swoft-favicon-48.ico -------------------------------------------------------------------------------- /src/devtool/web/dist/devtool/static/img/swoft-logo-text.0617d26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/dist/devtool/static/img/swoft-logo-text.0617d26.png -------------------------------------------------------------------------------- /src/devtool/web/dist/devtool/static/js/10.e8178500f2a68e34c250.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([10],{IFgZ:function(t,e){},ousr:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=a("B2YR"),n=a.n(s),r=a("h/uE"),o=a.n(r),i=a("/uRu"),c=a("ZXMi"),u={name:"aop-handlers",components:n()({VAlert:o.a},i),data:function(){return{dataMap:{}}},created:function(){this.fetchList()},mounted:function(){},computed:{},methods:{fetchList:function(){var t=this;Object(c.a)().then(function(e){var a=e.data;t.dataMap=a,console.log(a)})}}},d={render:function(){var t=this.$createElement,e=this._self._c||t;return e("v-layout",{attrs:{row:"",wrap:""}},[e("v-flex",{attrs:{xs12:""}},[e("v-subheader",[e("h1",[this._v(this._s(this.$t(this.$route.name)))])])],1),this._v(" "),e("v-flex",{attrs:{xs12:"",md4:""}},[e("v-card",[e("v-card-text",[this._v("\n hello\n ")])],1)],1),this._v(" "),e("v-flex",{attrs:{xs12:"",md8:""}},[e("v-card",{staticClass:"pa-3",attrs:{color:"amber lighten-5"}},[e("tree-view",{attrs:{data:this.dataMap,options:{maxDepth:4,rootObjectKey:"JSON"}}})],1)],1)],1)},staticRenderFns:[]};var h=a("E9e/")(u,d,!1,function(t){a("IFgZ")},"data-v-96bb0d28",null);e.default=h.exports}}); 2 | //# sourceMappingURL=10.e8178500f2a68e34c250.js.map -------------------------------------------------------------------------------- /src/devtool/web/dist/devtool/static/js/11.6fb9061b2dd7368a639f.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([11],{"3eKX":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n("9dsW"),a=n("ZXMi"),i={name:"http-middleware",components:{SimpleTable:s.a},data:function(){return{middles:[]}},created:function(){this.fetchList()},mounted:function(){},computed:{},methods:{fetchList:function(){var e=this;Object(a.i)().then(function(t){var n=t.data;console.log(n),e.middles=n})}}},r={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("v-subheader",[n("h1",[e._v(e._s(e.$t(this.$route.name)))])]),e._v(" "),n("simple-table",{staticClass:"table-bordered"},[n("template",{slot:"header"},[n("th",[e._v(" "+e._s(e.$t("App.number"))+" ")]),e._v(" "),n("th",[e._v(" "+e._s(e.$t("App.middlewareClass")))])]),e._v(" "),e._l(e.middles,function(t,s){return n("tr",{key:s},[n("td",[e._v(e._s(s))]),e._v(" "),n("td",[n("span",{staticClass:"el-tag"},[e._v(e._s(t))])])])})],2)],1)},staticRenderFns:[]};var d=n("E9e/")(i,r,!1,function(e){n("rKMD")},"data-v-7c4a9fe6",null);t.default=d.exports},rKMD:function(e,t){}}); 2 | //# sourceMappingURL=11.6fb9061b2dd7368a639f.js.map -------------------------------------------------------------------------------- /src/devtool/web/dist/devtool/static/js/12.18a35e70f4e20187c6c2.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([12],{sPWa:function(e,t){},wp8U:function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={render:function(){var e=this.$createElement,t=this._self._c||e;return t("div",[t("v-subheader",[t("h2",[this._v(this._s(this.$t(this.$route.name)))])]),this._v(" "),t("div",{staticStyle:{"font-size":"40px"}},[this._v("Un-completed")])],1)},staticRenderFns:[]};var i=s("E9e/")({name:"swoole-log"},n,!1,function(e){s("sPWa")},"data-v-74f4860a",null);t.default=i.exports}}); 2 | //# sourceMappingURL=12.18a35e70f4e20187c6c2.js.map -------------------------------------------------------------------------------- /src/devtool/web/dist/devtool/static/js/15.652987d5da1c5369ab8e.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([15],{HcBO:function(e,t){},STIK:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s={render:function(){var e=this.$createElement,t=this._self._c||e;return t("div",[t("v-subheader",[t("h1",[this._v(this._s(this.$t(this.$route.name)))])]),this._v(" "),t("div",{staticStyle:{"font-size":"40px"}},[this._v("Un-completed")])],1)},staticRenderFns:[]};var i=n("E9e/")({name:"app-log"},s,!1,function(e){n("HcBO")},"data-v-693421ef",null);t.default=i.exports}}); 2 | //# sourceMappingURL=15.652987d5da1c5369ab8e.js.map -------------------------------------------------------------------------------- /src/devtool/web/dist/devtool/static/js/18.aef9bddd1bf7a4f5dbcb.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([18],{Gwy3:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n("B2YR"),i=n.n(s),a=n("/uRu"),r=n("ZXMi"),c={name:"ServerInfo",components:i()({},a),data:function(){return{stats:[]}},created:function(){this.fetchList()},mounted:function(){},computed:{},methods:{fetchList:function(){var t=this;Object(r.p)().then(function(e){var n=e.data;console.log(n),t.stats=n})}}},v={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("v-subheader",[n("h2",[t._v(t._s(t.$t(this.$route.name)))])]),t._v(" "),n("v-layout",{attrs:{row:""}},[n("v-flex",{attrs:{xs12:"",sm6:"",md4:"",lg3:""}},[n("v-card",[n("v-card-title",{staticClass:"title grey lighten-3"},[t._v("Server Stats")]),t._v(" "),n("v-divider"),t._v(" "),n("v-list",{attrs:{dense:""}},t._l(t.stats,function(e,s){return n("v-list-tile",{key:s},[n("v-list-tile-content",[t._v(t._s(s))]),t._v(" "),n("v-list-tile-content",{staticClass:"align-end"},[t._v(t._s(e))])],1)}))],1)],1)],1)],1)},staticRenderFns:[]};var o=n("E9e/")(c,v,!1,function(t){n("eQQh")},"data-v-2de05fc6",null);e.default=o.exports},eQQh:function(t,e){}}); 2 | //# sourceMappingURL=18.aef9bddd1bf7a4f5dbcb.js.map -------------------------------------------------------------------------------- /src/devtool/web/dist/devtool/static/js/23.07c1314e692d6ed2f0f8.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([23],{PNWn:function(e,t){},Tcqx:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s={render:function(){var e=this.$createElement,t=this._self._c||e;return t("div",[t("v-subheader",[t("h1",[this._v(this._s(this.$t(this.$route.name)))])]),this._v(" "),t("div",{staticStyle:{"font-size":"40px"}},[this._v("Un-completed")])],1)},staticRenderFns:[]};var i=n("E9e/")({name:"RunTrace"},s,!1,function(e){n("PNWn")},"data-v-17dae6fa",null);t.default=i.exports}}); 2 | //# sourceMappingURL=23.07c1314e692d6ed2f0f8.js.map -------------------------------------------------------------------------------- /src/devtool/web/dist/devtool/static/js/9.2317d8e1a4e548cbde74.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([9],{UWze:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=n("9dsW"),a=n("ZXMi"),d={name:"http-middleware",components:{SimpleTable:s.a},data:function(){return{middles:[]}},created:function(){this.fetchList()},mounted:function(){},computed:{},methods:{fetchList:function(){var e=this;Object(a.l)().then(function(t){var n=t.data;console.log(n),e.middles=n})}}},i={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("v-subheader",[n("h1",[e._v(e._s(e.$t(this.$route.name)))])]),e._v(" "),n("simple-table",{staticClass:"table-bordered"},[n("template",{slot:"header"},[n("th",[e._v(" "+e._s(e.$t("App.number"))+" ")]),e._v(" "),n("th",[e._v(" "+e._s(e.$t("App.middlewareClass")))])]),e._v(" "),e._l(e.middles,function(t,s){return n("tr",{key:s},[n("td",[e._v(e._s(s))]),e._v(" "),n("td",[n("span",{staticClass:"el-tag"},[e._v(e._s(t))])])])})],2)],1)},staticRenderFns:[]};var r=n("E9e/")(d,i,!1,function(e){n("gxIw")},"data-v-9d0b134c",null);t.default=r.exports},gxIw:function(e,t){}}); 2 | //# sourceMappingURL=9.2317d8e1a4e548cbde74.js.map -------------------------------------------------------------------------------- /src/devtool/web/dist/index.html: -------------------------------------------------------------------------------- 1 | Dev tool for swoft
-------------------------------------------------------------------------------- /src/devtool/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Dev tool for swoft 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/devtool/web/src/.gitrepo: -------------------------------------------------------------------------------- 1 | ; DO NOT EDIT (unless you know what you are doing) 2 | ; 3 | ; This subdirectory is a git "subrepo", and this file is maintained by the 4 | ; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme 5 | ; 6 | [subrepo] 7 | remote = https://github.com/vuetifyjs/templates-common.git 8 | branch = subrepo/webpack-src 9 | commit = 090741fa8ba4da0c6f85db64eff64550704123e1 10 | parent = e05204fc0583a8c99f1963ce873eba1266838215 11 | method = merge 12 | cmdver = 0.4.0 13 | -------------------------------------------------------------------------------- /src/devtool/web/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/src/assets/logo.png -------------------------------------------------------------------------------- /src/devtool/web/src/assets/style/common.styl: -------------------------------------------------------------------------------- 1 | 2 | // for table, from bootstap 4 3 | .table-sm td, .table-sm th 4 | padding: .3rem !important; 5 | 6 | .table-bordered thead td, .table-bordered thead th 7 | border-bottom-width: 2px; 8 | 9 | .table-bordered td, .table-bordered th 10 | border: 1px solid #dee2e6; 11 | -------------------------------------------------------------------------------- /src/devtool/web/src/assets/swoft-favicon-48.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/src/assets/swoft-favicon-48.ico -------------------------------------------------------------------------------- /src/devtool/web/src/assets/swoft-favicon-64.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/src/assets/swoft-favicon-64.ico -------------------------------------------------------------------------------- /src/devtool/web/src/assets/swoft-logo-md.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/src/assets/swoft-logo-md.png -------------------------------------------------------------------------------- /src/devtool/web/src/assets/swoft-logo-sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/src/assets/swoft-logo-sm.png -------------------------------------------------------------------------------- /src/devtool/web/src/assets/swoft-logo-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/src/assets/swoft-logo-text.png -------------------------------------------------------------------------------- /src/devtool/web/src/config.js: -------------------------------------------------------------------------------- 1 | import merge from 'webpack-merge' 2 | 3 | let env 4 | 5 | if (process.env.NODE_ENV === 'development') { 6 | env = { 7 | baseUri: '/api' 8 | } 9 | } 10 | 11 | export default merge({ 12 | baseUri: '/__devtool', 13 | serverHost: 'http://127.0.0.1', 14 | serverPort: 8086 15 | }, env) 16 | -------------------------------------------------------------------------------- /src/devtool/web/src/libs/constants.js: -------------------------------------------------------------------------------- 1 | import { cache } from './util' 2 | 3 | export const URI_PREFIX = '/__devtool' 4 | 5 | // lang order: localStorage -> browser language -> default 6 | export const LANG = cache.get('site.lang') || navigator.language || 'zh-CN' 7 | 8 | export const ACCESS_TOKEN = 'test' 9 | -------------------------------------------------------------------------------- /src/devtool/web/src/libs/http.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import config from '../config' 3 | import { ACCESS_TOKEN } from './constants' 4 | 5 | // set base Url 6 | axios.defaults.baseURL = config.baseUri 7 | 8 | // Add a request interceptor 9 | axios.interceptors.request.use(function (config) { 10 | console.log('load ...') 11 | 12 | // config.headers['X-Requested-With'] = 'XMLHttpRequest' 13 | 14 | if (ACCESS_TOKEN) { 15 | config.headers['Authorization'] = `Bearer ${ACCESS_TOKEN}` 16 | } 17 | 18 | return config 19 | }, function (error) { 20 | // iView.LoadingBar.error() 21 | return Promise.reject(error) 22 | }) 23 | 24 | // Add a response interceptor 25 | axios.interceptors.response.use(function (response) { 26 | // iView.LoadingBar.finish() 27 | console.log('load ok') 28 | 29 | return response 30 | }, function (error) { 31 | // iView.LoadingBar.error() 32 | console.log('load fail') 33 | 34 | return Promise.reject(error) 35 | }) 36 | 37 | export const ajax = axios.create({ 38 | // baseURL: ajaxUrl, 39 | timeout: 30000, 40 | params: { 41 | _time: Date.parse(new Date()) / 1000 42 | }, 43 | headers: { 44 | 'X-Swoft-Devtool': '1.0.0', 45 | 'X-Requested-With': 'XMLHttpRequest' 46 | } 47 | }) 48 | -------------------------------------------------------------------------------- /src/devtool/web/src/locale/index.js: -------------------------------------------------------------------------------- 1 | 2 | let locale = { 3 | zh: require('./lang/zh-CN.js'), 4 | en: require('./lang/en-US.js') 5 | } 6 | 7 | export default locale 8 | -------------------------------------------------------------------------------- /src/devtool/web/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Routes from './routes' 4 | 5 | Vue.use(Router) 6 | 7 | const router = new Router({ 8 | mode: 'history', 9 | linkActiveClass: 'active', 10 | scrollBehavior: () => ({ y: 0 }), 11 | routes: Routes 12 | }) 13 | 14 | export default router 15 | -------------------------------------------------------------------------------- /src/devtool/web/src/views/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 32 | -------------------------------------------------------------------------------- /src/devtool/web/src/views/app/AopHandlers.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 51 | 52 | 55 | -------------------------------------------------------------------------------- /src/devtool/web/src/views/app/AppLog.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /src/devtool/web/src/views/app/RunTrace.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /src/devtool/web/src/views/http/HttpMiddleware.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 44 | 45 | 48 | -------------------------------------------------------------------------------- /src/devtool/web/src/views/parts/NProgress.vue: -------------------------------------------------------------------------------- 1 | 2 | 27 | 33 | -------------------------------------------------------------------------------- /src/devtool/web/src/views/parts/PageSearch.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 17 | 18 | 21 | -------------------------------------------------------------------------------- /src/devtool/web/src/views/parts/SimpleTable.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 23 | 24 | 26 | -------------------------------------------------------------------------------- /src/devtool/web/src/views/rpc/RpcMiddleware.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 44 | 45 | 48 | -------------------------------------------------------------------------------- /src/devtool/web/src/views/server/SwooleLog.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /src/devtool/web/static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/static/.gitkeep -------------------------------------------------------------------------------- /src/devtool/web/static/img/swoft-favicon-48.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swoft-cloud/swoft-ext/913f5ff48dbf0c27876dd19f0fc6202290a02f86/src/devtool/web/static/img/swoft-favicon-48.ico -------------------------------------------------------------------------------- /src/elasticsearch/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/elasticsearch/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Elasticsearch 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/elasticsearch.svg)](https://packagist.org/packages/swoft/elasticsearch) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Elasticsearch Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/elasticsearch 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/elasticsearch/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/elasticsearch", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft" 9 | ], 10 | "description": "micro-service framework base on swoole", 11 | "license": "Apache-2.0", 12 | "require": { 13 | "php": ">7.1", 14 | "swoft/stdlib": "~2.0.0", 15 | "swoft/connection-pool": "~2.0.0", 16 | "elasticsearch/elasticsearch": "^7.3", 17 | "composer/ca-bundle": "^1.2" 18 | }, 19 | "autoload": { 20 | "psr-4": { 21 | "Swoft\\Elasticsearch\\": "src/" 22 | } 23 | }, 24 | "require-dev": { 25 | "phpunit/phpunit": "^7.5" 26 | }, 27 | "autoload-dev": { 28 | "psr-4": { 29 | "SwoftTest\\Elasticsearch\\Unit\\": "test/unit/", 30 | "SwoftTest\\Elasticsearch\\Testing\\": "test/testing/" 31 | } 32 | }, 33 | "repositories": { 34 | }, 35 | "scripts": { 36 | "test": "./vendor/bin/phpunit -c phpunit.xml" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/elasticsearch/src/Eloquent/Collection.php: -------------------------------------------------------------------------------- 1 | items as $item) { 33 | $bool = $item->update($data) && $bool; 34 | } 35 | 36 | return $bool; 37 | } 38 | 39 | /** 40 | * delete 41 | * 42 | * @return bool 43 | */ 44 | public function delete(): bool 45 | { 46 | $bool = true; 47 | foreach ($this->items as $item) { 48 | $bool = $bool && $item->delete(); 49 | } 50 | 51 | return $bool; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/elasticsearch/src/Exception/ElasticsearchException.php: -------------------------------------------------------------------------------- 1 | response; 35 | } 36 | 37 | /** 38 | * @param array $response 39 | */ 40 | public function setResponse(array $response): void 41 | { 42 | $this->response = $response; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/elasticsearch/src/Listener/CoroutineDeferListener.php: -------------------------------------------------------------------------------- 1 | release(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/elasticsearch/src/Listener/CoroutineDestroyListener.php: -------------------------------------------------------------------------------- 1 | release(true); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/elasticsearch/src/Listener/WorkerStartListener.php: -------------------------------------------------------------------------------- 1 | initPool(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/grpc/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/grpc/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Grpc 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/grpc.svg)](https://packagist.org/packages/swoft/grpc) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Grpc Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/grpc 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/grpc/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/grpc", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft" 9 | ], 10 | "description": "micro-service framework base on swoole", 11 | "license": "Apache-2.0", 12 | "require": { 13 | "php": ">7.1", 14 | "swoft/stdlib": "~2.0.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Swoft\\Grpc\\": "src/" 19 | } 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "^7.5" 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "SwoftTest\\Grpc\\Unit\\": "test/unit/", 27 | "SwoftTest\\Grpc\\Testing\\": "test/testing/" 28 | } 29 | }, 30 | "repositories": { 31 | }, 32 | "scripts": { 33 | "test": "./vendor/bin/phpunit -c phpunit.xml" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/kafka/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/kafka/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Kafka 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/kafka.svg)](https://packagist.org/packages/swoft/kafka) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Kafka Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/kafka 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/kafka/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/kafka", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft" 9 | ], 10 | "description": "micro-service framework base on swoole", 11 | "license": "Apache-2.0", 12 | "require": { 13 | "php": ">7.1", 14 | "swoft/stdlib": "~2.0.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Swoft\\Kafka\\": "src/" 19 | } 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "^7.5" 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "SwoftTest\\Kafka\\Unit\\": "test/unit/", 27 | "SwoftTest\\Kafka\\Testing\\": "test/testing/" 28 | } 29 | }, 30 | "repositories": { 31 | }, 32 | "scripts": { 33 | "test": "./vendor/bin/phpunit -c phpunit.xml" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/limiter/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/limiter/.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .settings/ 3 | .project 4 | *.patch 5 | .idea/ 6 | .git/ 7 | runtime/ 8 | vendor/ 9 | temp/ 10 | *.lock 11 | .phpintel/ 12 | .env 13 | .DS_Store 14 | public/devtool/ -------------------------------------------------------------------------------- /src/limiter/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.1 5 | - 7.2 6 | - 7.3 7 | 8 | before_script: 9 | - composer config -g process-timeout 900 && composer update 10 | - phpenv config-rm xdebug.ini 11 | 12 | script: 13 | - composer test -------------------------------------------------------------------------------- /src/limiter/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Limiter 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/limiter.svg)](https://packagist.org/packages/swoft/limiter) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Limiter Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/limiter 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/limiter/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/limiter", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft" 9 | ], 10 | "description": "micro-service framework base on swoole", 11 | "license": "Apache-2.0", 12 | "require": { 13 | "php": ">7.1", 14 | "swoft/stdlib": "~2.0.0", 15 | "symfony/expression-language": "~4.3" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "Swoft\\Limiter\\": "src/" 20 | } 21 | }, 22 | "require-dev": { 23 | "phpunit/phpunit": "^7.5" 24 | }, 25 | "autoload-dev": { 26 | "psr-4": { 27 | "SwoftTest\\Limiter\\Unit\\": "test/unit/", 28 | "SwoftTest\\Limiter\\Testing\\": "test/testing/" 29 | } 30 | }, 31 | "repositories": { 32 | }, 33 | "scripts": { 34 | "test": "./vendor/bin/phpunit -c phpunit.xml" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/limiter/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./test/unit 15 | 16 | 17 | 18 | 19 | ./src/* 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/limiter/src/Annotation/Parser/RateLimiterParser.php: -------------------------------------------------------------------------------- 1 | className, $this->methodName, $annotationObject); 42 | return []; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/limiter/src/AutoLoader.php: -------------------------------------------------------------------------------- 1 | __DIR__, 32 | ]; 33 | } 34 | 35 | /** 36 | * @return array 37 | */ 38 | public function metadata(): array 39 | { 40 | $jsonFile = dirname(__DIR__) . '/composer.json'; 41 | 42 | return ComposerJSON::open($jsonFile)->getMetadata(); 43 | } 44 | 45 | /** 46 | * @return array 47 | */ 48 | public function beans(): array 49 | { 50 | return [ 51 | 'rateLimiter' => [ 52 | 'class' => RateLimter::class, 53 | 'rateLimter' => bean('redisRateLimiter'), 54 | ] 55 | ]; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/limiter/src/Contract/RateLimiterInterface.php: -------------------------------------------------------------------------------- 1 | __DIR__, 25 | ]; 26 | } 27 | 28 | /** 29 | * @return array 30 | */ 31 | public function metadata(): array 32 | { 33 | return []; 34 | } 35 | } -------------------------------------------------------------------------------- /src/limiter/test/testing/KeyHelper.php: -------------------------------------------------------------------------------- 1 | [ 7 | 'class' => RedisDb::class, 8 | 'host' => '127.0.0.1', 9 | 'port' => 6379, 10 | 'database' => 0, 11 | ], 12 | ]; -------------------------------------------------------------------------------- /src/session/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/session/.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .settings/ 3 | .project 4 | *.patch 5 | .idea/ 6 | .git/ 7 | runtime/ 8 | vendor/ 9 | temp/ 10 | *.lock 11 | .phpintel/ 12 | .DS_Store -------------------------------------------------------------------------------- /src/session/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Session 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/session.svg)](https://packagist.org/packages/swoft/session) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Http Session Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/session 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/session/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/session", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft", 9 | "swoft-component", 10 | "http-session", 11 | "session" 12 | ], 13 | "description": "Http session component for swoft", 14 | "license": "Apache-2.0", 15 | "require": { 16 | "swoft/http-message": "~2.0.0", 17 | "swoft/stdlib": "~2.0.0" 18 | }, 19 | "require-dev": { 20 | "phpunit/phpunit": "^7.5" 21 | }, 22 | "autoload": { 23 | "psr-4": { 24 | "Swoft\\Http\\Session\\": "src/" 25 | } 26 | }, 27 | "autoload-dev": { 28 | "psr-4": { 29 | "SwoftTest\\Http\\Session\\Unit\\": "test/unit/", 30 | "SwoftTest\\Http\\Session\\Testing\\": "test/testing/" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/session/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./test/Cases 14 | 15 | 16 | 17 | 18 | ./app 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/session/src/Contract/SessionIdInterface.php: -------------------------------------------------------------------------------- 1 | 7.1", 14 | "swoft/stdlib": "~2.0.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Swoft\\Swagger\\": "src/" 19 | } 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "^7.5" 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "SwoftTest\\Swagger\\Unit\\": "test/unit/", 27 | "SwoftTest\\Swagger\\Testing\\": "test/testing/" 28 | } 29 | }, 30 | "repositories": { 31 | }, 32 | "scripts": { 33 | "test": "./vendor/bin/phpunit -c phpunit.xml" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/swagger/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./test/unit 15 | 16 | 17 | 18 | 19 | ./src/* 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/swagger/src/Annotation/Mapping/ApiSchema.php: -------------------------------------------------------------------------------- 1 | name = $values['value']; 39 | } 40 | 41 | if (isset($values['name'])) { 42 | $this->name = $values['name']; 43 | } 44 | } 45 | 46 | /** 47 | * @param string $name 48 | */ 49 | public function setName(string $name): void 50 | { 51 | $this->name = $name; 52 | } 53 | 54 | /** 55 | * @return string 56 | */ 57 | public function getName(): string 58 | { 59 | return $this->name; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/swagger/src/Annotation/Parser/ApiEntityParser.php: -------------------------------------------------------------------------------- 1 | className) 40 | ); 41 | } 42 | 43 | ApiRegister::registerInfo($annotationObject); 44 | return []; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/swagger/src/Annotation/Parser/ApiLicenseParser.php: -------------------------------------------------------------------------------- 1 | className) 40 | ); 41 | } 42 | 43 | ApiRegister::registerLicense($annotationObject); 44 | return []; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/swagger/src/Autoloader.php: -------------------------------------------------------------------------------- 1 | __DIR__, 31 | ]; 32 | } 33 | 34 | /** 35 | * @return array 36 | */ 37 | public function metadata(): array 38 | { 39 | return []; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/swagger/src/Command/SwaggerCommand.php: -------------------------------------------------------------------------------- 1 | swagger->gen(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/swagger/src/ContentType.php: -------------------------------------------------------------------------------- 1 | name = $name; 41 | } 42 | 43 | /** 44 | * @param string $url 45 | */ 46 | public function setUrl(string $url): void 47 | { 48 | $this->url = $url; 49 | } 50 | 51 | /** 52 | * @param string $email 53 | */ 54 | public function setEmail(string $email): void 55 | { 56 | $this->email = $email; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/swagger/src/Node/Header.php: -------------------------------------------------------------------------------- 1 | name = $name; 36 | } 37 | 38 | /** 39 | * @param string $url 40 | */ 41 | public function setUrl(string $url): void 42 | { 43 | $this->url = $url; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/swagger/src/Node/MediaType.php: -------------------------------------------------------------------------------- 1 | schema = $schema; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/swagger/src/Node/Parameter.php: -------------------------------------------------------------------------------- 1 | paths = $data; 34 | } 35 | 36 | /** 37 | * @return array 38 | */ 39 | public function getPaths(): array 40 | { 41 | return $this->paths; 42 | } 43 | 44 | /** 45 | * @param array $paths 46 | */ 47 | public function setPaths(array $paths): void 48 | { 49 | $this->paths = $paths; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/swagger/src/Node/RequestBody.php: -------------------------------------------------------------------------------- 1 | description = $description; 36 | } 37 | 38 | /** 39 | * @param MediaType[] $content 40 | */ 41 | public function setContent(array $content): void 42 | { 43 | $this->content = $content; 44 | } 45 | 46 | /** 47 | * @param bool $required 48 | */ 49 | public function setRequired(bool $required): void 50 | { 51 | $this->required = $required; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/swagger/src/Node/Response.php: -------------------------------------------------------------------------------- 1 | description = $description; 41 | } 42 | 43 | /** 44 | * @param Header $headers 45 | */ 46 | public function setHeaders(Header $headers): void 47 | { 48 | $this->headers = $headers; 49 | } 50 | 51 | /** 52 | * @param MediaType[] $content 53 | */ 54 | public function setContent(array $content): void 55 | { 56 | $this->content = $content; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/swagger/src/Node/Responses.php: -------------------------------------------------------------------------------- 1 | url = $url; 36 | } 37 | 38 | /** 39 | * @param string $description 40 | */ 41 | public function setDescription(string $description): void 42 | { 43 | $this->description = $description; 44 | } 45 | 46 | /** 47 | * @param ServerVariable[] $variables 48 | */ 49 | public function setVariables(array $variables): void 50 | { 51 | $this->variables = $variables; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/swagger/src/Node/ServerVariable.php: -------------------------------------------------------------------------------- 1 | $value) { 34 | if (!property_exists($self, $property)) { 35 | throw new InvalidArgumentException('Schema args is not exist!'); 36 | } 37 | 38 | $self->{$property} = $value; 39 | } 40 | 41 | return $self; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/swagger/test/testing/Application.php: -------------------------------------------------------------------------------- 1 | __DIR__, 25 | ]; 26 | } 27 | 28 | /** 29 | * @return array 30 | */ 31 | public function metadata(): array 32 | { 33 | return []; 34 | } 35 | } -------------------------------------------------------------------------------- /src/swagger/test/testing/Schema/IndexOther.php: -------------------------------------------------------------------------------- 1 | 7.1", 14 | "swoft/stdlib": "~2.0.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Swoft\\Swoole\\Tracker\\": "src/" 19 | } 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "^7.5" 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "SwoftTest\\Swoole\\Tracker\\Unit\\": "test/unit/", 27 | "SwoftTest\\Swoole\\Tracker\\Testing\\": "test/testing/" 28 | } 29 | }, 30 | "scripts": { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/swoole-tracker/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./test/unit 15 | 16 | 17 | 18 | 19 | ./src/* 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/swoole-tracker/src/AutoLoader.php: -------------------------------------------------------------------------------- 1 | __DIR__, 31 | ]; 32 | } 33 | 34 | /** 35 | * @return array 36 | */ 37 | public function metadata(): array 38 | { 39 | return []; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/swoole-tracker/test/bootstrap.php: -------------------------------------------------------------------------------- 1 | $dir) { 19 | $loader->addPsr4($prefix, $componentDir . '/' . $dir); 20 | } 21 | 22 | // need load testing psr4 config map 23 | $componentDir = dirname(__DIR__, 4) . '/ext'; 24 | $componentJson = $componentDir . '/composer.json'; 25 | $composerData = json_decode(file_get_contents($componentJson), true); 26 | 27 | foreach ($composerData['autoload-dev']['psr-4'] as $prefix => $dir) { 28 | $loader->addPsr4($prefix, $componentDir . '/' . $dir); 29 | } 30 | } else { 31 | exit('Please run "composer install" to install the dependencies' . PHP_EOL); 32 | } -------------------------------------------------------------------------------- /src/swoole-tracker/test/unit/SwooleTrackerTest.php: -------------------------------------------------------------------------------- 1 | > ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini 11 | 12 | before_script: 13 | - phpenv config-rm xdebug.ini 14 | - composer update 15 | 16 | script: composer test 17 | -------------------------------------------------------------------------------- /src/view/README.md: -------------------------------------------------------------------------------- 1 | # Swoft View 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/view.svg)](https://packagist.org/packages/swoft/view) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft View Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/view 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/view/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/view", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft", 9 | "view" 10 | ], 11 | "description": "micro-service framework base on swoole", 12 | "license": "Apache-2.0", 13 | "require": { 14 | "swoft/framework": "^2.0.2" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Swoft\\View\\": "src/" 19 | }, 20 | "files": [ 21 | "src/Helper/Functions.php" 22 | ] 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "SwoftTest\\View\\": "test/case" 27 | } 28 | }, 29 | "repositories": [ 30 | { 31 | "type": "composer", 32 | "url": "https://packagist.laravel-china.org" 33 | } 34 | ], 35 | "require-dev": { 36 | "phpunit/phpunit": "^7.5" 37 | }, 38 | "scripts": { 39 | "test": "./vendor/bin/phpunit -c phpunit.xml" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/view/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | test/unit 14 | 15 | 16 | 17 | 18 | src 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/view/src/Contract/ViewInterface.php: -------------------------------------------------------------------------------- 1 | getResponse(); 32 | $content = $renderer->render(Swoft::getAlias($template), $data, $layout); 33 | 34 | return $response->withContent($content)->withHeader('Content-Type', 'text/html'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/view/src/ViewRegister.php: -------------------------------------------------------------------------------- 1 | $dir) { 17 | $loader->addPsr4($prefix, $packageDir . '/' . $dir); 18 | } 19 | } else { 20 | exit('Please run "composer install" to install the dependencies' . PHP_EOL); 21 | } 22 | -------------------------------------------------------------------------------- /src/view/test/fixture/layout.php: -------------------------------------------------------------------------------- 1 | A{_CONTENT_}C -------------------------------------------------------------------------------- /src/whoops/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/whoops/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/ 2 | .idea -------------------------------------------------------------------------------- /src/whoops/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/whoops", 3 | "description": "Whoops Component for Swoft", 4 | "type": "library", 5 | "version": "v2.0.11", 6 | "homepage": "https://github.com/swoft-cloud/swoft", 7 | "keywords": [ 8 | "php", 9 | "swoole", 10 | "swoft" 11 | ], 12 | "license": "Apache-2.0", 13 | "require": { 14 | "php": ">7.1", 15 | "filp/whoops": "^2.4" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "Swoft\\Whoops\\": "src/" 20 | } 21 | }, 22 | "autoload-dev": { 23 | "psr-4": { 24 | "SwoftTest\\Whoops\\Unit\\": "test/unit/", 25 | "SwoftTest\\Whoops\\Testing\\": "test/testing/" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/whoops/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./test/unit 15 | 16 | 17 | 18 | 19 | ./src/* 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/whoops/src/AutoLoader.php: -------------------------------------------------------------------------------- 1 | __DIR__, 31 | ]; 32 | } 33 | 34 | /** 35 | * @return array 36 | */ 37 | public function metadata(): array 38 | { 39 | $jsonFile = dirname(__DIR__) . '/composer.json'; 40 | 41 | return ComposerJSON::open($jsonFile)->getMetadata(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/whoops/test/bootstrap.php: -------------------------------------------------------------------------------- 1 | $dir) { 19 | $loader->addPsr4($prefix, $componentDir . '/' . $dir); 20 | } 21 | 22 | // need load testing psr4 config map 23 | $componentDir = dirname(__DIR__, 4) . '/ext'; 24 | $componentJson = $componentDir . '/composer.json'; 25 | $composerData = json_decode(file_get_contents($componentJson), true); 26 | 27 | foreach ($composerData['autoload-dev']['psr-4'] as $prefix => $dir) { 28 | $loader->addPsr4($prefix, $componentDir . '/' . $dir); 29 | } 30 | } else { 31 | exit('Please run "composer install" to install the dependencies' . PHP_EOL); 32 | } -------------------------------------------------------------------------------- /src/whoops/test/testing/Whoops.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 19 | } 20 | } -------------------------------------------------------------------------------- /src/zipkin/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Swoft Issues 4 | url: https://github.com/swoft-cloud/swoft/issues 5 | about: Please report security vulnerabilities here. 请打开此页面报告bug或改进问题! 6 | - name: Swoft Development 7 | url: https://github.com/swoft-cloud/swoft-component 8 | about: Participate in contributing swoft code, please jump to this project. 参与贡献swoft代码,请跳转到这个项目 9 | - name: Swoft 中文文档 10 | url: https://swoft.org 11 | about: Please ask and answer questions here. swoft 2.0新版风格中文文档请访问此网站。 12 | - name: Swoft English Documents 13 | url: http://swoft.io 14 | about: Please report security vulnerabilities here. swoft英文文档或者旧版风格文档请访问此网站。 15 | -------------------------------------------------------------------------------- /src/zipkin/README.md: -------------------------------------------------------------------------------- 1 | # Swoft Zipkin 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/swoft/zipkin.svg)](https://packagist.org/packages/swoft/zipkin) 4 | [![Php Version](https://img.shields.io/badge/php-%3E=7.1-brightgreen.svg?maxAge=2592000)](https://secure.php.net/) 5 | [![Swoft Doc](https://img.shields.io/badge/docs-passing-green.svg?maxAge=2592000)](https://www.swoft.org/docs) 6 | [![Swoft License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://github.com/swoft-cloud/swoft/blob/master/LICENSE) 7 | 8 | Swoft Zipkin Component 9 | 10 | ## Install 11 | 12 | - composer command 13 | 14 | ```bash 15 | composer require swoft/zipkin 16 | ``` 17 | 18 | ## Resources 19 | 20 | * [Documentation](https://swoft.org/docs) 21 | * [Contributing](https://github.com/swoft-cloud/swoft/blob/master/CONTRIBUTING.md) 22 | * [Report Issues][issues] and [Send Pull Requests][pulls] in the [Main Swoft Repository][repository] 23 | 24 | [pulls]: https://github.com/swoft-cloud/swoft-component/pulls 25 | [repository]: https://github.com/swoft-cloud/swoft 26 | [issues]: https://github.com/swoft-cloud/swoft/issues 27 | 28 | ## LICENSE 29 | 30 | The Component is open-sourced software licensed under the [Apache license](LICENSE). 31 | -------------------------------------------------------------------------------- /src/zipkin/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swoft/zipkin", 3 | "type": "library", 4 | "version": "v2.0.11", 5 | "keywords": [ 6 | "php", 7 | "swoole", 8 | "swoft" 9 | ], 10 | "description": "micro-service framework base on swoole", 11 | "license": "Apache-2.0", 12 | "require": { 13 | "php": ">7.1", 14 | "swoft/stdlib": "~2.0.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Swoft\\Zipkin\\": "src/" 19 | } 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "^7.5" 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "SwoftTest\\Zipkin\\Unit\\": "test/unit/", 27 | "SwoftTest\\Zipkin\\Testing\\": "test/testing/" 28 | } 29 | }, 30 | "repositories": { 31 | }, 32 | "scripts": { 33 | "test": "./vendor/bin/phpunit -c phpunit.xml" 34 | } 35 | } 36 | --------------------------------------------------------------------------------