Code Monkey home page Code Monkey logo

php-paymo-api-wrapper's Introduction

PHP wrapper for Paymo's API

This is a wrapper for Paymo's API. Please feel free to fork it and make it better!

What's included?

  • Caching class - this is used to cache up the returned responses from Paymo's API.

  • The main Paymo class - this includes all the methods

  • The Paymo and Cache classes have both been commented with Doxygen format comments (the Doxygen config file is here too).

Example

Below is a very short example of how this can be used:

<?php
	
	/**
	 * Require both our Paymo and Cache classes
	 */
	 
	require_once 'class-cache.php';
	require_once 'class-paymo.php';
	
	/**
	 * Set some initial vars to indicate we want JSON as the response format
	 * Turn on the authentication cache
	 * Also turn on the data cache
	 */
	
	$api_response_format = 'json';
	$use_auth_cache = true;
	$use_data_cache = true;
	
	/**
	 * Create a new instance of the Paymo class, passing login details as required
	 */
	
	$paymo = new Paymo(
		'your_api_key',
		'your_username',
		'your_password',
		$use_auth_cache,
		$use_data_cache,
		$api_response_format
	);
	
	/**
	 * Print out a list of all our clients
	 */
	 
	print_r( $paymo->clients_getList() );

	/**
	 * Print out a list of invoices between April and August of 2012
	 * For date format see: http://api.paymo.biz/docs/misc.dates.html
	 */

	$client_id = null;
	$start = '2012-04-01';
	$end = '2012-08-01';
	$status = 'paid';

	print_r( $paymo->invoices_find( $client_id, $start, $end, $status ) );
	
?>

Caching

At the moment caching is mixed with the Paymo class. I'd like to split this soon so that it could be used independently. It uses MD5 to create a hash of the API URL & parameters. By doing this you can cache individual API calls to the same method. One use case is for different logins to the API.

php-paymo-api-wrapper's People

Contributors

jamesduncombe avatar sixthlife avatar yisraeldov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.