2017 © Pedro Peláez
 

library mitey

PHP Wrapper for the mite API

image

hubersen/mitey

PHP Wrapper for the mite API

  • Monday, January 29, 2018
  • by hubeRsen
  • Repository
  • 2 Watchers
  • 20 Stars
  • 1,387 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 1 Versions
  • 71 % Grown

The README.md

Mitey - PHP Wrapper for the mite API

This script provides easy access to the mite API via php objects. You'll be able to use code hinting in your IDE., (*1)

Requirements

Mitey requires the following * PHP 5.3.0 or higher * PHP cURL, (*2)

Quick start

Clone this repo into any webserver and call examples/index.php, there you can put in your mite API credentials and test some methods and check the response values this script provides. If you are, for whatever reason, not able to clone this, you can go to http://dev.codeschmiede.de/Mitey/examples/ for the example page., (*3)

Usage

<?php
// include the Mite class
require_once 'mite/Mite.php';
// instantiate the object with your credentials
$mite = new Mite\Mite('YOUR-MITE-API-ENDPOINT', 'YOUR-MITE-API-KEY');

Now you have access to all methods the mite API has, for example get objects of all your customers, (*4)

<?php
$customers = $mite->getCustomers();
for ($customers->rewind(); $customers->valid(); $customers->next())
{
    $customer = $customers->current();
    echo $customer->name . "<br />";
}

// all this methods will return iterator objects
$iterator = $mite->getArchivedProjects();
$iterator = $mite->getCustomers();
$iterator = $mite->getProjects();
$iterator = $mite->getTimes();
$iterator = $mite->getGroupedTimes(array('week, project'));
$iterator = $mite->getUsers();

Get customer details of a specified account, (*5)

<?php
$customer = $mite->getCustomer(1234); // 1234 is the needed customer id
// $customer contains a object of type MiteCustomer

Add new stuff to your mite account (customers, projects, times), (*6)

<?php
// new customer
$newCustomer = $mite->addCustomer(array(
    'name' => 'My new customer name',
    'note' => 'Generated via Mitey, totally easy. Whoop whoop.'
));

// new project
$newProject = $mite->addProject(array(
    'name' => 'My brand new project',
    'note' => 'Generated via Mitey, totally easy. Whoop whoop.',
    'customer_id' => $newCustomer->id
));

// new time entry
$newtime = $mite->addTime(
    date('Y-m-d'),          // date of time entry
    666,                    // time in seconds
    'My workdescription, created via Mitey, whoop whoop.',
    $mite->getMyself()->id, // user id
    $newProject->id,        // optional: project id
    false                   // optional: service id
);

Look into the code Mite/Mite.php for a complete list of methods this library provides., (*7)

Contact

In case you wanna get in touch, it's easy! * Twitter: @hubeRsen * Website: https://paschi.dev, (*8)

The Versions

29/01 2018

dev-master

9999999-dev

PHP Wrapper for the mite API

  Sources   Download

The Requires

  • php >=5.3.0