PHPackages                             mindtwo/laravel-clickup-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. mindtwo/laravel-clickup-api

ActiveLibrary[API Development](/categories/api)

mindtwo/laravel-clickup-api
===========================

A PHP Composer package for Laravel, designed to seamlessly integrate Laravel applications with ClickUp's system for streamlined project management and task tracking.

2.0.1(3mo ago)75.9k↑18.4%1[2 PRs](https://github.com/mindtwo/laravel-clickup-api/pulls)MITPHPPHP ^8.2CI passing

Since Apr 5Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/mindtwo/laravel-clickup-api)[ Packagist](https://packagist.org/packages/mindtwo/laravel-clickup-api)[ Docs](https://github.com/mindtwo/laravel-clickup-api)[ GitHub Sponsors](https://github.com/mindtwo)[ RSS](/packages/mindtwo-laravel-clickup-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (18)Versions (18)Used By (0)

Laravel ClickUp API
===================

[](#laravel-clickup-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/41c0f13458183be711140612db15f1e92c2f41dbef3bfd697fe5604f35723fd3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696e6474776f2f6c61726176656c2d636c69636b75702d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mindtwo/laravel-clickup-api)[![GitHub Tests Action Status](https://camo.githubusercontent.com/4bea4c336e132f1d8f1aa864fbd90b380879bee17c854813f9dad482fab52218/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d696e6474776f2f6c61726176656c2d636c69636b75702d6170692f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mindtwo/laravel-clickup-api/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/ed492d1b4789f5fc521b7f8de960182fc720a440fd94d81e38f119a29ce8dec9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d696e6474776f2f6c61726176656c2d636c69636b75702d6170692f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/mindtwo/laravel-clickup-api/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/e1efd7a8c6d8278124c3193ff55c6d48e55657ad2d81987ed8c6663324e91683/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696e6474776f2f6c61726176656c2d636c69636b75702d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mindtwo/laravel-clickup-api)

This Laravel package provides a convenient and efficient way to integrate your Laravel application with ClickUp, a popular project management tool. Designed for ease of use, it offers a seamless connection, enabling your Laravel application to interact with [ClickUp's APIs](https://developer.clickup.com/docs/general-v2-v3-api) for task management, project tracking, and more. Whether you're looking to automate project updates, synchronize tasks, or enhance team collaboration, this package streamlines the process, making it easier to keep your projects organized and up-to-date directly from your Laravel application.

**Please note:** that this package currently supports a limited set of ClickUp endpoints, specifically those related to Tasks, Attachments, and Custom Fields. We are actively working to expand our coverage of ClickUp's API to include more endpoints and functionalities. If you require integration with aspects of ClickUp not yet covered by our package, we appreciate your patience and welcome contributions or suggestions to enhance our offering.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require mindtwo/laravel-clickup-api
```

You can publish the config file with:

```
php artisan vendor:publish --tag="clickup-api-config"
```

This is the contents of the published [config file](config/clickup-api.php).

You must publish and run the package migrations:

```
php artisan vendor:publish --tag="clickup-api-migrations"
php artisan migrate
```

The migrations will create the necessary database tables for managing ClickUp webhooks, including:

- `clickup_webhooks` - Stores webhook registrations and health status
- `clickup_webhook_deliveries` - Tracks webhook delivery history

ENV Configuration
-----------------

[](#env-configuration)

To ensure the proper functioning of this Laravel package with ClickUp, you must provide your ClickUp API key by setting the `CLICKUP_API_KEY` constant in your application's environment configuration. Here's how to find your ClickUp API key:

1. Log in to your ClickUp account and navigate to your profile settings by clicking on your profile picture in the bottom left corner.
2. Select "Apps" from the sidebar menu.
3. Scroll to the "API" section and find the "Generate" button to create a new API key. If you've already generated one, it will be displayed here.
4. Copy the API key and add it to your Laravel `.env` file as follows: ```
    CLICKUP_API_KEY=your_clickup_api_key_here

    ```

Make sure to replace `your_clickup_api_key_here` with the actual API key you obtained from ClickUp. This step is crucial for authenticating your Laravel application's requests to ClickUp's API.

Usage
-----

[](#usage)

This package provides a clean and intuitive Facade interface for interacting with ClickUp's API. All endpoints can be accessed through the `ClickUp` facade, making your code more readable and maintainable.

### Using the Facade

[](#using-the-facade)

First, import the ClickUp facade at the top of your PHP file:

```
use Mindtwo\LaravelClickUpApi\Facades\ClickUpClient as ClickUp;
```

Now you can access all ClickUp endpoints through the facade:

```
// Tasks
ClickUp::tasks()->create($listId, $taskDetails);
ClickUp::tasks()->index($listId, $filters);
ClickUp::tasks()->show($taskId);
ClickUp::tasks()->update($taskId, $updates);
ClickUp::tasks()->delete($taskId);

// Spaces
ClickUp::spaces()->index($teamId);
ClickUp::spaces()->create($teamId, $spaceDetails);

// Folders
ClickUp::folders()->index($spaceId);
ClickUp::folders()->create($spaceId, $folderDetails);

// Lists
ClickUp::lists()->index($folderId);
ClickUp::lists()->create($folderId, $listDetails);

// Custom Fields
ClickUp::customFields()->show($listId);
ClickUp::customFields()->set($taskId, $fieldId, $value);

// Attachments
ClickUp::attachments()->create($taskId, $fileData);

// Subtasks
ClickUp::subtasks()->create($taskId, $subtaskDetails);

// Milestones
ClickUp::milestones()->create($listId, $milestoneDetails);

// Task Dependencies
ClickUp::dependencies()->add($taskId, $dependsOn, $dependencyType);
ClickUp::dependencies()->remove($taskId, $dependsOn, $dependencyType);

// Task Links
ClickUp::links()->create($taskId, $linksTo);
ClickUp::links()->remove($taskId, $linksTo);
```

### Alternative: Using the app() Helper

[](#alternative-using-the-app-helper)

If you prefer not to use facades, you can still access endpoints using the `app()` helper:

```
app(\Mindtwo\LaravelClickUpApi\Http\Endpoints\Task::class)->create($listId, $taskDetails);
```

However, we recommend using the Facade for cleaner and more readable code.

### Task Endpoint Usage

[](#task-endpoint-usage)

The `Task` class within the Laravel ClickUp API package provides a simple interface for interacting with ClickUp's Task-related API endpoints. This class allows you to list, view, create, update, and delete tasks within ClickUp, directly from your Laravel application. Here's a quick overview of how to use it:

- **List Tasks**: Retrieve all tasks within a specific list by providing the list ID.
- **Show Task Details**: Get detailed information about a specific task using its task ID.
- **Create Task**: Create a new task within a list by providing the list ID and an array of task details.
- **Update Task**: Update an existing task by providing the task ID and the details to be updated.
- **Delete Task**: Delete a task using its task ID.

#### How to Use:

[](#how-to-use)

First, import the facade:

```
use Mindtwo\LaravelClickUpApi\Facades\ClickUpClient as ClickUp;
```

1. **Create a Task**: To create a new task within a list, you can use the `create` method. Pass the list ID where the task should be created and an array of data that specifies the task details.

    ```
    $taskDetails = [
        'name' => 'New Task', // Mandatory
        'description' => 'Task description', // Optional
        // Add other task details as needed
    ];

    $task = ClickUp::tasks()->create($listId, $taskDetails);
    ```
2. **Get Tasks in a List**: To retrieve tasks within a list, use the `index`method with the list ID and an optional array of query parameters to filter the tasks.

    ```
    $tasks = ClickUp::tasks()->index($listId, []);
    ```
3. **Show Task Details**: To get detailed information about a task, use the `show` method with the task ID.

    ```
    $task = ClickUp::tasks()->show($taskId);
    ```
4. **Update a Task**: To update an existing task, use the `update` method with the task ID and an array of data with the details you wish to update.

    ```
    $updatedDetails = [
        'name' => 'Updated Task Name',
        // Other task details you want to update
    ];

    $updatedTask = ClickUp::tasks()->update($taskId, $updatedDetails);
    ```
5. **Delete a Task**: To delete a task, use the `delete` method with the task ID.

    ```
    $response = ClickUp::tasks()->delete($taskId);
    ```

These examples demonstrate the fundamental operations you can perform on tasks within ClickUp through your Laravel application, providing a powerful way to integrate task management functionalities into your workflow.

### Attachment Endpoint Usage

[](#attachment-endpoint-usage)

The `Attachment` class within this Laravel package facilitates the creation of attachments in tasks on ClickUp. By utilizing the `create` method, users can easily upload files and associate them with a specific task by its ID. This functionality enhances the task management process, allowing for a more detailed and resource-rich task structure.

To use this endpoint, first ensure that you have a task ID (`$taskId`) where you want to attach a file, and prepare the data (`$data`) according to the ClickUp API specifications for attachments. The `$data` should include the file information structured in a way that's compatible with ClickUp's expectations for attachment uploads.

Here's a basic example on how to use the `Attachment` endpoint:

```
