areyi/taskmanager
Composer 安装命令:
composer require areyi/taskmanager
包简介
A simple task manager for Laravel 5
README 文档
README
A simple task manager for Laravel
- Simple and extensible
- Method chaining
- Formatter (alpha)
TaskManager is a Laravel package which allows you to create projects, and create tasks. The package is in development stage for time being, and not ready for production uses.
Version
0.3.2
Requirements
- Laravel - version 5 (version 4 <= untested, need help here).
- PHP - version => 5.3
Installation
Download the package as a zip, and then put it on /vendor folder.
Add the following line on your composer.json file, under the psr-4:
"psr-4": {
...
"Areyi\\TaskManager\\": "vendor/areyi/taskmanager/src"
}
After that, register the TaskManagerServiceProvider in the /config/app.php file, under the providers array:
'Areyi\TaskManager\Laravel\TaskManagerServiceProvider'
And in the same file, put the TaskManager alias under the aliases array:
'TaskManager' => 'Areyi\TaskManager\Facades\TaskManager'
And finally, run all the migration files
php artisan migrate --path=vendor/areyi/taskmanager/src/database/migrations
Usage
First, you must supply with the user_id (which you can get from your favourite authentication managers). This will make sure projects and tasks belongs to the right user.
$user_id = 1; // get from your login manager TaskManager::setUserId($user_id);
1. To create a new project:
Try this:
$project_details = [ 'name' => 'New Project', 'name' => 'new_project', //optional ]; TaskManager::addProject($project_details);
which will return:
Areyi\TaskManager\Base Object
(
[userID] => 1
[result] => 1
[project_id] => 77
)
2. To create a new task:
You can straightaway creating a task without supplying the project_id if you have created a project before
$task_details = [ 'name' => 'New Task' ]; TaskManager::addTask($task_details);
or you can also chain them to create multiple tasks:
TaskManager::addTask($task_details)->addTask($task2_details)->addTask($task3_details);
which will return:
Areyi\TaskManager\Base Object
(
[userID] => 1
[result] => 1
[project_id] => 79
[task_id] => Array
(
[0] => 75
[1] => 76
[2] => 77
)
)
and you can also create project and add tasks to it at the same time:
TaskManager::addProject($project_details)->addTask($task_details)->addTask($task_details);
3. Get all projects:
To get all existing projects:
TaskManager::getProjects();
which will returns straightaway:
Areyi\TaskManager\Base Object
(
[userID] => 1
[projects] => Array
(
[0] => Array
(
[id] => 1
[name] => Web Development Project
[slug] => webdev
[owner_id] => 1
[owner] => admin
[created_at] => 2015-12-26 01:00:55
[updated_at] => 2015-12-26 01:00:55
)
[1] => Array
(
[id] => 2
[name] => New Project
[slug] => new_project
[owner_id] => 2
[owner] => staff
[created_at] => 2015-12-26 01:43:38
[updated_at] => 2015-12-26 01:43:38
)
)
)
4. Get all tasks with specified project_id
To get all tasks assign to a project:
$project_id = 1; TaskManager::getProject($project_id)->getTasks();
which returns:
Areyi\TaskManager\Base Object
(
[userID] => 1
[id] => 1
[name] => Web Development Project
[slug] => webdev
[owner_id] => 1
[owner] => admin
[created_at] => 2015-12-26 01:43:38
[updated_at] => 2015-12-26 01:43:38
[tasks] => Array
(
[0] => Array
(
[id] => 1
[name] => Buy a milk
[slug] =>
[author_id] => 1
[author] => admin
[completed] => 0
[description] =>
[created_at] => 2015-12-26 01:43:38
[updated_at] => 2015-12-26 01:43:38
)
[1] => Array
(
[id] => 2
[name] => Buy a book
[slug] =>
[author_id] => 1
[author] => admin
[completed] => 0
[description] =>
[created_at] => 2015-12-26 01:43:38
[updated_at] => 2015-12-26 01:43:38
)
)
)
5. Get the whole thing
You can also get all projects along with their tasks:
TaskManager::getAll();
6. Delete a project
To delete a project (this will also delete all tasks under the same project):
$projectId = 1; TaskManager::deleteProject($projectId);
7. Delete a task
To delete a task:
$task_id = 1; TaskManager::deleteTask($task_id);
8. Mark a task as completed
To mark a task as completed:
TaskManager::completeTask($task_id)
Formatting
This is still under development! TaskManager is included with a powerful formatter, allowing you to edit or delete projects/tasks and complete a task on the run. The formatter is powered by AJAX.
1. Get all projects as list
To list all projects as a list
TaskManager::getProjects()->format()->asList();
Result:
2. Get all tasks as list
To list all tasks under a project as a list
$project_id = 1; TaskManager::getProject($project_id)->getTasks()->format()->asList();
Result:
List of available routes
These are the available routes in the package:
| Route | Uses |
|---|---|
| GET /taskmanager/list/all | List all projects and tasks |
| GET /taskmanager/list/projects | List all projects |
| GET /taskmanager/list/project/{project_id} | Get a project with the given project id |
| GET /taskmanager/list/tasks/{project_id} | Get tasks associated with the project id |
| GET /taskmanager/delete/project/{project_id} | Delete the project |
| GET /taskmanager/delete/task/{task_id} | Delete the task |
| GET /taskmanager/complete/task/{task_id} | Mark the task as completed |
List of avaiable methods
These are the methods in the package:
| Method | Uses |
|---|---|
| TaskManager::setUserId($userId); | Set the ownership for all projects and tasks |
| TaskManager::addProject($project_details); | Create a new project |
| TaskManager::addTask($task_details); | Add a new task |
| TaskManager::getProjects(); | Get all projects |
| TaskManager::getProject($project_id); | Get a project by given project_id |
| TaskManager::getTasks(); | Get all tasks |
| TaskManager::getTask($project_id); | Get a task by given project_id |
| TaskManager::getAll(); | Get all projects and their tasks |
| TaskManager::deleteProject($projectId); | Delete a project |
| TaskManager::deleteTask($taskId); | Delete a task |
| TaskManager::completeTask($taskId); | Mark a task as done |
| TaskManager::format(); | (todo) |
Todos
- Formatter (50%)
License
BSD 3-Clause
Contributions
Feel free to contribute to the project! It will be much appriciated! And most importantly, its a Free Software, Hell Yeah!
areyi/taskmanager 适用场景与选型建议
areyi/taskmanager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 47 次下载、GitHub Stars 达 10, 最近一次更新时间为 2015 年 12 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「laravel」 「todo」 「project manager」 「areyi」 「task manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 areyi/taskmanager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 areyi/taskmanager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 areyi/taskmanager 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Make temporary Laravel workarounds expire and fail CI when ignored.
A plugin for Roundcube to include CalDAVZap in to the main GUI
Alfabank REST API integration
Outputs all todo and fixme comments presents in php files
A todo.txt parsing and validation library for PHP
Command Line todo list app
统计信息
- 总下载量: 47
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2015-12-28