sectheater/laravel-jarvis
Composer 安装命令:
composer require sectheater/laravel-jarvis
包简介
Achieve Your Ambition with me
README 文档
README
Made with ❤️ by SecTheater Foundation: http://www.sectheater.org
Package Documentation : http://www.sectheater.org/documentation
the Jarvis CheatSheet will be availble soon
Jarvis provides you the following :
1. Authentication System
Login, Register, Reminders,Security Questions for reseting passwords and Activations.
2. Comment System & Reply System
3. Like/Dislike System
You could always like,dislike anything such as comments,replies and posts. Also you could reset this like so the user's like or dislike is removed
4. Upgrading & Downgrading Users
5. Approving Anything
You could approve anything just by providing the model and the ID of the record you wish to approve
6.Tag
Assign Tags to whatever on your application
You can Assign one tag or multiple tags within one text input and you can set the separator dynamically
7. Authorizing Users & Managing Roles.
Installation Steps
1. Require the Package
After creating your new Laravel application you can include the Jarvis package with the following command:
composer require sectheater/laravel-jarvis:dev-master
2. Add the DB Credentials & APP_URL
Next make sure to create a new database and add your database credentials to your .env file:
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
You will also want to update your website URL inside of the APP_URL variable inside the .env file:
APP_URL=http://localhost:8000
3. Getting Your Environment Ready.
Just Run The following command.
php artisan sectheater:install
Command Interpretation
1- It sets up your config file by registering whatever you confirm within the survey, in case you use Everything option that command supplies, the default configuration will be used. If you ever want to change anything , go to your config/jarvis.php and set whatever you need. 2- It will provide you a survey so the package sets up which features have to be enabled. 3- It also sets up the authentication routes.
Jarvis doesn't depend on models at all, Everything runs through the repositories to provide you the best quality.
4. Sample Usage
4.1 Registering A User
Whenever you try to register a user, just supply Jarivs with the data and the slug of the role which you want to assign to this user and if you wish to activate this user, pass the third argument
Jarvis::registerWithRole($data,'user',true)
4.2 Login A User
Logging a user is also an easy thing to do, just pass the data the user tries to attempt with , It can be username/email and password or whatever. Then if you want to remember the user , pass the second argument with true.
Jarvis::login($data,true) // jarvis()->login($data,true);
4.3 Checking For Roles.
Let's assume I want to check whether the current logged in user has any permissions to create a post or not. It's worth mentioning that whenever you pass many elements to check on and the user has any of them, The method will return you a boolean value
Jarvis::User()->hasAnyRole(['create-post'])
We are just checking here if the user has either creating permission under the user/moderator permissions.
Jarvis::User()->hasAnyRole(['create-tag','moderator.create-tag']) /* first permission determines what the role the user has and then check if he has this permission , second one checks if the user has moderator.create-tag and this should exist in users table permissions column, as this doesn't exist in default roles table ( unless you add it ) */
Sometimes, you want to check if a specific user has all of the roles , not just any of them. Well That's also included.
Jarvis::User()->hasAllRole(['create-post','edit-post'])
If you want to check on only one permission, you can pass that to the HasAnyRole within an array, Or just do it like the following.
Jarvis::User()->hasRole('view-post')
If you want to check whether the user has any of the post permissions or whatever, you can do it like the following .
// you can use the helper also jarvis()->user()->hasRole('*-post');
There is much more details within the documentation.
Recently Added Features
Recent Changes
-
Jarvis Middleware is removed.
-
Policies & Gates are set automatically depending on the database roles.
-
Existing relationships Dynamically set depending on existing models either through properties or config file.
-
Observers watch models that has been bounded to the config file dynamically.
-
package_version function is added ( checks the version of any package passed to it )
-
model_exists function is now checking for the user models
-
jarvis_model_exists function only checks for Jarvis's models only.
-
recent method is added to all of Repositories ( you can fetch with it recent stuff under condition and,or approved stuff )
-
Repository Interface updated
-
Basic Repository Is updated, now you can pass to the delete and update methods either an identifier to find or the instance that should be updated/deleted.
-
make:facade command is added
-
make:response command is added
-
make:repository is added
-
package_path function is added
-
Relationships are synchronized with the related models dynamically.
-
Roles Trait is updated.
Extra Commands are added such as :
- sectheater:register-authorization // registers the policies and gates and publishing them , depending on your database roles.
- make:observer
- sectheater:seed-db , seeding your database with the RolesSeeder and call for register-authorization ( optional)
Fixes :
- Routes in blades are fixed.
- Jarvis routes method is fixed, removed from web file and It will be added in your Route Service Provider
- app.blade.php is copied during running sectheater:auth if it doesn't exist
- RegisterWithRole method is fixed.
sectheater/laravel-jarvis 适用场景与选型建议
sectheater/laravel-jarvis 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 117 次下载、GitHub Stars 达 32, 最近一次更新时间为 2018 年 02 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「admin」 「authorization」 「Authentication」 「cms」 「laravel」 「roles」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sectheater/laravel-jarvis 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sectheater/laravel-jarvis 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sectheater/laravel-jarvis 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Automatically logs-in users if they are already authenticated by a remote source. (e.g. environment variable REMOTE_USER)
2lenet/EasyAdminPlusBundle
GraphQL authentication for your headless Craft CMS applications.
Ory-Hydra OAuth 2.0 Client Provider for The PHP League OAuth2-Client
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
Analysis module for finding problematical shop data.
统计信息
- 总下载量: 117
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 32
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-06