codebar-ag / laravel-microsoft-planner
This is my package laravel-microsoft-planner
Requires
- php: >=8.2
- illuminate/contracts: ^11.0
- saloonphp/saloon: ^3.4
- spatie/laravel-data: ^4.4
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.13
- nunomaduro/collision: ^8.1
- orchestra/testbench: ^9.0
- pestphp/pest: ^2.31
- pestphp/pest-plugin-arch: ^2.6
- pestphp/pest-plugin-laravel: ^2.2
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- spatie/laravel-ray: ^1.33
This package is auto-updated.
Last update: 2024-11-29 16:12:02 UTC
README
This package was developed to interface with Microsoft Planner.
💡 What is Laravel Microsoft Planner?
/ Laravel Microsoft Planner is an opinionated way to interface with Microsoft Planner.
🛠 Requirements
<= v1.0
- PHP:
^8.2
- Laravel:
^10.*
⚙️ Installation
You can install the package via composer:
composer require codebar-ag/laravel-microsoft-planner
Add the following environment variables to your .env
file:
MICROSOFT_PLANNER_CLIENT_ID=your-client-id MICROSOFT_PLANNER_TENANT_ID=your-tenant-id MICROSOFT_PLANNER_CLIENT_SECRET=your-client-secret
🔧 Configuration file
You can publish the config file with:
php artisan vendor:publish --tag=microsoft-planner-config
This is the contents of the published config file:
<?php // config for CodebarAg/LaravelMicrosoftPlanner return [ 'auth' => [ 'client_id' => env('LARAVEL_MICROSOFT_PLANNER_CLIENT_ID'), 'client_secret' => env('LARAVEL_MICROSOFT_PLANNER_CLIENT_SECRET'), 'tenant_id' => env('LARAVEL_MICROSOFT_PLANNER_TENANT_ID'), ] ];
🏗 Usage
use CodebarAg\LaravelMicrosoftPlanner\Http\Connectors\MicrosoftPlannerConnector; use CodebarAg\LaravelMicrosoftPlanner\Http\Requests\Bucket\GetBucketTasksRequest; use CodebarAg\LaravelMicrosoftPlanner\Http\Requests\Tasks\GetTaskRequest; use CodebarAg\LaravelMicrosoftPlanner\Http\Requests\Tasks\GetTaskDetailsRequest; use CodebarAg\LaravelMicrosoftPlanner\Http\Requests\Tasks\PatchTaskRequest; use CodebarAg\LaravelMicrosoftPlanner\Http\Requests\Tasks\PatchTaskDetialsRequest; $connector = new MicrosoftPlannerConnector(); $authenticator = $connector->getAccessToken(); $connector->authenticate($authenticator);
// Get all tasks from a bucket $tasksResponse = $connector->send(new GetBucketTasksRequest(bucketId: 'bucket-id')); $tasks = $tasksResponse->dto();
// Get a single task $taskResponse = $connector->send(new GetTaskRequest(taskId: 'task-id')); $task = $taskResponse->dto();
// Get a tasks details $taskDetailsResponse = $connector->send(new GetTaskDetailsRequest(taskId: 'task-id')); $taskDetails = $taskDetailsResponse->dto();
// Update a task $updateTaskRequest = new PatchTaskRequest(taskId: 'task-id', etag: $task->eTag); $updateTaskRequest->body()->add('somedetail', 'somevalue'); $updateTaskResponse = $connector->send($updateTaskRequest); if ($updatedTask->successful()) { // Do something }
// Update a tasks details $updateTaskDetailsRequest = new PatchTaskDetialsRequest(taskId: 'task-id', etag: $taskDetails->eTag); $updateTaskDetailsRequest->body()->add('somedetail', 'somevalue'); $updateTaskDetailsResponse = $connector->send($updateTaskDetailsRequest); if ($updatedTaskDetails->successful()) { // Do something }
🏋️ DTO showcase
CodebarAg\LaravelMicrosoftPlanner\Data\Checklist { +id: "2f071481-095d-4363-abd9-29ef845a8b05" // string +isChecked: true, // bool +title: "sometask" // string +orderHint: "858", // string +lastModifiedDateTime: "2021-08-31T13:00:00Z" // string +lastModifiedByUserId: "1234456" // string|null }
CodebarAg\LaravelMicrosoftPlanner\Data\Note { +contentType: 'html' // string +content: '<p>Some content</p>' // string }
CodebarAg\LaravelMicrosoftPlanner\Data\Reference { +alias: "test.pdf" // string +url: "https://something.here/in-this-file/test.pdf" // string +type: "pdf" // string +previewPriority: "858" // string +lastModifiedDateTime: "2021-08-31T13:00:00Z" // string +lastModifiedByUserId: "1234456" // string }
CodebarAg\LaravelMicrosoftPlanner\Data\TaskDetails { +eTag: "W/"1238934jbdf89bfdkkjbr34g98hh98vhhcc="" // string +description: "Some Description" // string +previewType: "noPreview" // string +id: "EZAPnP4uBkGAMqyd2dneWJcAOGbk" // string +notes: CodebarAg\LaravelMicrosoftPlanner\Data\Note // Note +references: Illuminate\Support\Collection // Collection +checklist: Illuminate\Support\Collection // Collection }
CodebarAg\LaravelMicrosoftPlanner\Data\Task { +eTag: "W/"JzEtVGFzsdfsdEBAQEBAQEBAQEBAQEBJcCc="" // string +planId: "aL8rSpzb_0-0IGcHql4P0ZcAG3_B" // string +bucketId: "09AEzJXp0E6zY5LEE2Wsv5cAOdQd" // string +title: "Task Title" // string +orderHint: "8585037232077788756Pe" // string +assigneePriority: "" // string +percentComplete: 100 // int +completed: true // bool +startDateTime: Carbon // Carbon\Carbon|null +createdDateTime: Carbon // Carbon\Carbon +dueDateTime: Carbon // Carbon\Carbon|null +recurrence: null // array|null +hasDescription: true // bool +specifiedCompletionRequirements: "none" // string +previewType: "noPreview" // string +completedDateTime: Carbon // Carbon\Carbon|null +completedBy: array // array +referenceCount: 2 // int +checklistItemCount: 3 // int +activeChecklistItemCount: 2 // int +conversationThreadId: "AAQkADk1ZG" // string|null +priority: 1 // int +creationSource: null // string|null +id: "EZAPnP4uBkGAMqyd2dneWJcAOGbk" // string +createdBy: array // array +appliedCategories: array // array +assignments: array // array
🚧 Testing
Copy your own phpunit.xml-file.
cp phpunit.xml.dist phpunit.xml
Run the tests:
./vendor/bin/pest
📝 Changelog
Please see CHANGELOG for more information on what has changed recently.
✏️ Contributing
Please see CONTRIBUTING for details.
🧑💻 Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
🙏 Credits
🎭 License
The MIT License (MIT). Please see License File for more information.