langaner / phalcon-micro-starter
Phalcon微框架启动器
Requires
- firebase/php-jwt: ^5.0
- symfony/var-dumper: *
This package is not auto-updated.
Last update: 2024-09-10 16:17:20 UTC
README
这是一个包含jwt令牌认证的框架项目。
如何安装
运行 composer create-project langaner/phalcon-micro-starter project-directory --prefer-source
或下载zip文件。
文件夹
Controllers - 所有应用程序控制器
Middleware - 中间件集合
Models - 模型文件夹
Presenters - 展示器。您可以通过从模型调用它来使用它 $this->userRepository->getModel()->getPresenter()->test
Providers - 所有应用程序提供者
Repositories - 所有仓库。您可以通过调用 $this->userRepository->test() 来使用它
Services - 所有应用程序服务。您可以通过调用 $this->userService->test() 来使用它
routes - 所有路由。您可以将它们分开到文件中或全部写入routes.php
路由
http://servarname.server/auth/login - 登录路由。此路由提供用户认证并返回其令牌。所有路由都通过AuthMiddleware进行保护。认证设置位于auth配置文件中。
绑定
要使用仓库、服务、展示器,您必须在AppProvider中注册绑定到它们。
示例
仓库 - $this->bindRepository('userRepository', UserRepository::class, [new UserModel]);
服务 - $this->bindService('userService', UserService::class, [$this->getDi()->get('userRepository')]);
展示器 - $this->bindRepository('userPresenter', UserPresenter::class, [new UserModel]);