Posts Tagged ‘freebies’

29 April, 2014 — Development

Debitoor API Helper Class Version 2.0

Last year I published a PHP API Helper class for the ever-growing Debitoor accounting software. The API is a RESTful API meaning it responds to JSON and HTTPS requests.

As I have got to use this class in projects of mine, I have built upon this class adding improvements and a new Debitoor class that will process your requests for you returning a clean PHP array ready for you to use.

So what has changed?

You can find a list below of what I changed in this release and some newly added files.

Example.php

//Debitoor API Class
// Code by Daniel Roizer - http://thatblogger.co
// v2.0

define(req_code, "REQUEST_CODE");
define(clientID, "CLIENT_ID");
define(clientSecret, "SECRET_KEY");
define(token, "TOKEN_FROM_API");
define(apiURL, "https://app.debitoor.com/api/v1.0/");

require_once("debitoorapi.class.php");
require_once("debitoor.class.php");

$debitoor = new Debitoor();

// Get list of clients as an array()
print_r($debitoor->GetCustomers());

// Get list of products as an array()
print_r($debitoor->GetProducts());

// Add a client
print_r($debitoor->AddClient($name, $address, $phone, $email, $homepage, $cinumber, $vatnumber, $countrycode));

Download Now

You can download version 2.0 of the helper class over at GitHub!
– OR –
View on GitHub

This is not part of Debitoor and is code written by myself. If you wish to have something added or have any questions please comment below or submit a ticket over a GitHub.

16 October, 2013 — Development

Debitoor API Helper Class

As you may know if you read my review of Debitoor a few weeks ago, I am a big fan of their service. When I first found Debitoor, they didn’t have an OpenAPI for people to use. I wanted to send data from my website right into Debitoor without the need to enter the information twice. This was when I went over to there feedback forum and requested the public API. They accepted my request and yesterday Debitoor released some exciting news.

There API is now ready to use. I jumped right into it and started developing my application. The API is a RESTful API meaning it responsed to JSON and HTTPS requests. I decided to write a quick PHP helper class to allow quick sending and receiving of data to the Debitoor API.

You can download version 1.0 of the helper class here!

This is not part of Debitoor and is code written by myself. If you wish to have something added or have any questions please comment below.

UPDATE: Please also find this on GitHub

9 August, 2013 — Blogging, Reviews

Free Stock Images for your blog!

A few months ago I published a post about how to find free stock images for your blog or website. You can find that here. However I have just come across a website that has some stunning imagery on it – and best of all its free!

Tell Me Who!

Pixabay is a user generated free stock image website. At the time of writing this post, the website stats say it has a huge 93,683 images in there library all free to download and can be used freely in digital and printed format, for personal and commercial use. Attribution to the original author is also not required. All you need to do is create an account and you can begin downloading right away.

The website does have adverts on until you upload at least 10 images into the library. Once you have done that all adverts disappear. I know what you might be thinking – user uploaded photos.. they must be very poor quality. Well this is where you are wrong. Yes there are some rubbish images however a very high percentage are amazing quality as they have a review process for every image uploaded. Images are available to download in multiple sizes.

Pixabay is available in 20 languages making it accessible to people around the world, meaning they can build a bigger and bigger repository.

Is There A WordPress Plugin?

Pixabay has a WordPress plugin that you can install to add images with one click – you can read more about this plugin on there blog.

Features include:

  • Search Pixabay’s public domain pictures via the “Add Media” button inside your post editor, or find it attached as new tab to WordPress’ new Media Manager.
  • Filter search results by image type (clipart, photo) and/or orientation (landscape, portrait).
  • Preview images in paginated search results.
  • Direct image uploads to WordPress’ media library.
  • Use of standard media dialogues for editing and inserting images.

Once you install and activate the free plugin, you’ll have access to 90,000+ quality images.

9 August, 2013 — Blogging, Reviews

Introducing Debitoor – Free Invoicing & Accounting Software

I know how annoying accounting may be for some people, other’s like me might love it! However whether you love it or hate it, it needs to be simple. Before switching to Debitoor I was using FreeAgent – FreeAgent wasn’t bad, but it was over complicated for my needs and most of all it was costing me £15 a month to do the odd bit of invoicing here and there. This was when I started looking around. First I found something called Wave Accounting – Wave is 100% free like Debitoor however they have adverts. Something I don’t mind, but again it started to get complicated for no reason… then finally I stumbled across Debitoor.

What is Debitoor?

Debitoor is a 100% free invoicing and accounting application which helps freelancers and small businesses produce easy and professional invoices.

The company was launched in April 2012 by the international online accounting software company e-conomic. Realising that the self-employed people need less functionality and even easier-to-use interfaces.

The application is available in seven languages and localised to over 40 countries around the world.

Really? 100% Free?

Really its 100% free for basic invoicing and accounting functionality. They do offer a Premium service at a reasonable €5 /month which includes; Quotes, Reminders (Scheduled Invoices) & Document Handling. So you can upload all your receipts into one secure environment.

What Do I Think?

I like Debitoor a lot and I use it more and more now. I like the way its clean and simple. They even have a user feedback form where users can request features to be included in later version of Debitoor.

Why don’t you give Debitoor a go? It’s free after all! I would be keen to hear your comments and experience with Debitoor in the comments below.

6 August, 2013 — Development, Snippets

Simple PHP Template Class

Update: Now available on GitHub here. Please commit improvements.

For a recent project of mine (newsletter system) I needed a simple but effective PHP class that would allow me to send a string of data and find every word with the curly bracket around it and replace it with a word or string.

For example in my newsletter system, I needed the email’s to be customized to the person it would be sending it to such as Dear Daniel… Dear James…. but during the loop to send the email I would need to get the script to switch {name} to be Daniel. To do this I found this amazing little PHP class that does just the job.

Download

Click here to download Simple PHP Template Class.

The Usage

This class is very simple. You pass 3 variables into the function Replace.

  1. An array of keys and variables – the key will be what the script will look for in your template such as {name}. The value will be what {name} will be replaced with.
  2. The template string where the data will be replaced.
  3. If the template is case sensitive. Eg {Name} wouldn’t work in the below example where as {name} would.
// Array of variables to change, template string, case sensitive true/false
echo CurlyVariables::Replace(array('name' => $name, 'email' => $email), $string, true);

Any trouble please let me know in the comments below.

Photo by: Travis Isaacs

24 July, 2013 — Development, Snippets

Simple PHP MySQL Database Class

Update: Now available on GitHub here. Please commit improvements.

A while back now I decided to dive into OOP (Object-oriented programming) in PHP. Until then I had not really had any experience with OOP as functional PHP did the job just fine for me at the time. Now I have had some time getting to know OOP I realised why so many people now use it!

The first thing I wanted to learn was the basics and like with 90% of my projects this would involve a mySQL database connection and queries. That was where I began. Reading about the PDO class (a database package included in PHP) I quickly understood that using the class command “extends” I could write my own class to simplify my database interaction process.

Download

Click here to download my mySQL database class. (Note: this class can be adjusted for other database types)

The Usage

Like with any class we need to initialize the class and assign it to a variable.

$database = new Database();

Then we can do any of the following…

Simple Insert Query
Simply insert records to a table.

// Simple Insert Query
$database->query('INSERT INTO mytable (FName, LName, Age, Gender) VALUES (:fname, :lname, :age, :gender)');

// Bind the data
$database->bind(':fname', 'John');
$database->bind(':lname', 'Smith');
$database->bind(':age', '24');
$database->bind(':gender', 'male');

$database->execute();

Insert Multiple Records using a Transaction
You can insert multiple records using the transaction function. This allows you to run 1 query and multiple binds to insert a lot of rows at once.

// Begin the Transaction.
$database->beginTransaction();

// Query
$database->query('INSERT INTO mytable (FName, LName, Age, Gender) VALUES (:fname, :lname, :age, :gender)');

// Bind the Data
$database->bind(':fname', 'Jenny');
$database->bind(':lname', 'Smith');
$database->bind(':age', '23');
$database->bind(':gender', 'female');

// Execute that data
$database->execute();

// Bind the next set of data
$database->bind(':fname', 'Jilly');
$database->bind(':lname', 'Smith');
$database->bind(':age', '25');
$database->bind(':gender', 'female');

// Execute that data
$database->execute();

// End the transaction
$database->endTransaction();

Get Last Insert ID
Simple – Get the ID of the last record inserted.

echo $database->lastInsertId();

Select a Single Row
Select just a single row of data from a table.

// Query
$database->query('SELECT FName, LName, Age, Gender FROM mytable WHERE FName = :fname');

// Bind data
$database->bind(':fname', 'Jenny');

// Next we run the single method and save it into the variable $row.
$row = $database->single();

echo "
";
print_r($row);
echo "
";

Select Multiple Rows
Get a selection of rows from a table and add them to an array ready to be processed using foreach().

// Query
$database->query('SELECT FName, LName, Age, Gender FROM mytable WHERE LName = :lname');

// Bind data
$database->bind(':lname', 'Smith');

// Run the resultSet method and save it into the $rows variable.
$rows = $database->resultset();

echo "
";
print_r($rows);
echo "
";

Count Rows

// Display the number of records returned
echo $database->rowCount();

I hope you find this script useful. Please comment if you have any questions or found this useful.

Photo by: Chris Hsia