xnekv03 / freelo-api-client
Freelo api wrapper
v1.0.0
2020-02-08 13:13 UTC
Requires
- php: >=7.1
- ext-json: *
- guzzlehttp/guzzle: ^6.5
- nesbot/carbon: ^2.28
Requires (Dev)
- phpstan/phpstan: ^0.12
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2024-04-29 04:14:03 UTC
README
This library makes it easy to send requests towards Freelo API
Installation
The recommended way to install package is through Composer.
# Install Composer curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version of package:
composer require xnekv03/freelo-api-client
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
You can then later update package using composer:
composer update
Usage
Before you start
Create a Freelo account
Get your API key
Login to your Dashboard, go to your Settings and obtain your API key which will be something like
9lDZU35Lb0wmnq4tWvmmUkugLja4dXwPDcOMP1CBdIa
Initialize API Client
# load autoload file require_once 'vendor/autoload.php'; # Import Freelo library use Freelo\Client; $freeloApiToken = '9lDZU35Lb0wmnq4tWvmmUkugLja4dXwPDcOMP1CBdIa'; $loginEmail = 'john@doe.com'; # Initialize a client $freeloClient = new Client($freeloApiToken,$loginEmail);
Create project
$projectName = "Project Alice"; $currencyIso = "EUR"; // currently EUR, USD or CZK is supported $projectId = $freeloClient->createProject($projectName, $currencyIso); echo $projectId; // 74201 - project ID is returned
Collection of all own projects including active To-Do lists
$projects = $freeloClient->getAllOwnProjectIncludinglToDo(); var_dump($projects); // array with all projects including their names, IDs and task lists
Paginated collection of all invited projects
$projects = $freeloClient->getAllInvitedProjects(); var_dump($projects); // array with all invited projects
Paginated collection of all archived projects
$projects = $freeloClient->getAllArchivededProjects(); var_dump($projects); // array with all archived projects
Paginated collection of all templated projects
$projects = $freeloClient->getAllTemplateProjects(); var_dump($projects); // array with all templated projects
Project workers collection
$projectId = 73335; $projectsWorkers = $freeloClient->allProjectWorkers($projectId); var_dump($projectsWorkers); // array with all workers assigned to given project
Create to-do list
$projectId = 73335; // ID of an existing project $budget = 10205; // 2 decimal places with no decimal separator, ie. 1.05 = '105' $listName = 'Pre-launch test'; $projectDetails = $freeloClient->createToDoList($projectId, $budget, $listName); var_dump($projectDetails); // array with task details
Find all assignable workers for To-Do list
$projectId = 73335; // ID of an existing project $taskId = 179444; // ID of existing task $workers = $freeloClient->assignableWorkersCollection($projectId, $taskId); var_dump($workers); // array with available workers and their IDs