robinthijsen/laravel-monday
Composer 安装命令:
composer require robinthijsen/laravel-monday
包简介
A Monday API support for Laravel
README 文档
README
Installation
This is a Laravel package to easily use the Monday.com API.
You can also use it in vanilla PHP.
First install the package via composer:
composer require robinthijsen/laravel-monday
(Optionally) You can publish the config file to change the default configuration.
# That's currently changing anything so don't do it # I'm planning to add some config for future version php artisan vendor:publish --tag="monday-config"
This is the contents of the published config file:
You should define your monday.com API token in the .env file.
return [ 'token' => env('MONDAY_API_TOKEN'), 'version' => env('MONDAY_API_VERSION', '2024-04'), ];
Usage
Before starting to use the package, you should get your API token from Monday.com
and look about the documentation of monday object on the Monday.com API documentation.
Okay, let's start using the package.
If you know a bit about dynamic classes and props, this package work this way.
# This is a list of every Monday object you can use in this package # Or find them in the src/Objects directory use \RobinThijsen\LaravelMonday\Objects\Account; use \RobinThijsen\LaravelMonday\Objects\AccountProduct; use \RobinThijsen\LaravelMonday\Objects\Block; use \RobinThijsen\LaravelMonday\Objects\Board; use \RobinThijsen\LaravelMonday\Objects\Column; use \RobinThijsen\LaravelMonday\Objects\ColumnValue; use \RobinThijsen\LaravelMonday\Objects\Doc; use \RobinThijsen\LaravelMonday\Objects\Group; use \RobinThijsen\LaravelMonday\Objects\Icon; use \RobinThijsen\LaravelMonday\Objects\Item; use \RobinThijsen\LaravelMonday\Objects\Plan; use \RobinThijsen\LaravelMonday\Objects\Team; use \RobinThijsen\LaravelMonday\Objects\User; use \RobinThijsen\LaravelMonday\Objects\Workspace; use \RobinThijsen\LaravelMonday\Objects\WorkspaceSetting;
You can start a query builder by calling the ::query() or ::find() method on the object you want to query (If the object doesn't accept querying and unique querying, an Exception will be thrown).
use \RobinThijsen\LaravelMonday\Objects\Board; # This is an example of querying all the boards # The following params are for Board object # Check params for other objects in the src/Objects directory /** * @param int|array|null $ids => default null * @param int|array|null $workspaceIds => default null * @param int $limit => default 25 * @param int $page => default 1 * @param string $kind => default BoardKind::PUBLIC * @param string $state => default State::ACTIVE * @return \RobinThijsen\LaravelMonday\Objects\Board[] */ $boards = Board::query();
::query() and ::find() accept dynamic arguments depending on the object you are querying.
Then, you can chain the query builder with the following methods: ->with() and ->withObject()
use \RobinThijsen\LaravelMonday\Objects\Board; use \RobinThijsen\LaravelMonday\Objects\Item; # This is an example of querying all the boards with the items $boards = Board::query() ->with('id', 'name') ->withObject(Item::class, [], ['id', 'name']);
/** * FieldsName are the fields you want to get from the object * If the field is not in the object or if it is an object field, an Exception will be thrown * * @param string ...$fieldNames */ public function with(...$fieldNames)
/** * Get an object with the given field names * * @param string $fieldName * @param array|Closure $params * @param array $fields */ public function withObject($fieldName, $params = [], $fields = [])
To call object of object, you need to use the withObject method.
but with a Closure method replacing param $params.
use \RobinThijsen\LaravelMonday\Objects\Board; use \RobinThijsen\LaravelMonday\Objects\Item; use \RobinThijsen\LaravelMonday\Objects\ColumnValue; // In this exemple, I recover the board with id 123456 // with all his items and all the column values of each item with specific default fields for each object $board = Board::find(123456) ->with('id', 'name') ->withObject(Item::class, function ($builder) { $builder->with('id', 'name') ->withObject(ColumnValue::class, [], ['text', 'value']); });
When your query is ready, you can call the ->get() method to get the results.
// This will return you an instance of Board class with asked fields as props // For this exemple, it will be id and name $board = Board::find(123456) ->with('id', 'name') ->get();
Author
License
The MIT License (MIT). Please see License File for more information.
robinthijsen/laravel-monday 适用场景与选型建议
robinthijsen/laravel-monday 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 53 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 07 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「laravel」 「robin」 「monday」 「laravel-monday」 「robinthijsen」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 robinthijsen/laravel-monday 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 robinthijsen/laravel-monday 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 robinthijsen/laravel-monday 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Round-robin schedule generation implementation in PHP
Load balancer between nodes.
This package provides a simple `make:action` command to generate invokable action classes
A PSR-7 compatible library for making CRUD API endpoints
Alfabank REST API integration
Proxy Rotation with Load balancing strategies
统计信息
- 总下载量: 53
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-06