Useful PHP Class for Developers

CSource

Below I have put together some useful PHP class for developers. This class is ready to be combined with the popular framework or working alone. You will find several classes such as PDF converter, CSS parser, XML, creating zip, video downloader from YouTube and others.

My favorite class is: fast speed IP locator, where the user simply enter an IP address and this class will determine the address and google map.

TCPDF

A professional PHP class for generating PDF files on-the-fly, a powerful solution with over ten years of development under its belt

Download

PHP CSS Parser

 

A PHP class for reading CSS files and extracting CSS code out of them, making them available as PHP objects to various data processing applications

Download

SimpleLogger

A PHP class that can be used in logging the output of PHP-based applications, helping developers track and debug their app’s performance

Download

CssToInlineStyles Class

 

A PHP class for converting normal HTML pages into pages with inline CSS styles

Download

mPDF

 

A PHP class for rendering HTML content as PDF output

Download

CSource

CSource

A PHP class for displaying source code inside a Web page, complete with a syntax highlighting theme and support for multiple file formats

Download

array-to-csv

 

A PHP class for converting a PHP array into a CSV data structure, ideal for exporting the content of a PHP app to a more wide-spread format

Download

FastSpeedIpLocator

FastSpeedIpLocator

See from where your site’s visitors are coming from with this small PHP class that converts IP addresses into real geographical locations

Download

StormTwitter

 

A PHP class for interacting with Twitter

Download

Minify

 

A set of PHP classes for minifying CSS and JavaScript code, ideal for optimizing your code for usage in production-ready environments

Download

PHPZip

 

A PHP class for creating archives in ZIP format

Download

SimpleCrypt

SimpleCrypt

A PHP class for adding cryptography support to your Web applications via PHP’s MCrypt extension, securing sensitive content when needed

Download

yt_downloader

yt_downloader

An open source PHP class that can download YouTube videos (the audio track, thumbnail image, and various details) to your own computer

Download

php-videoGet

php-videoGet

An open source PHP class for retrieving meta data information about a video, supporting well known services like Vimeo and YouTube

Download

Craur

 

A PHP-based XML to JSON converter, and vice-versa

Download

mysql-search-replace

 

An open source, lightweight and easy to use PHP class for searching and replacing a piece of text across an entire MySQL database

Download

phpFastCache

 

A PHP class that can serve as a generic interface for multiple caching systems, helping developers improve their site’s performance by taking some load off their databases

Download

phpMyGraph

phpMyGraph

This is a PHP script that can be used to render several types of charts and graphs

Download

Amazon S3 PHP Class

 

This is a PHP class for uploading files to an Amazon S3 account

Download

URL Normalizer

 

This is a PHP class to normalize URL strings, following the RFC 3986 recommendation

Download

mp3Data

 

A PHP class to extract MP3 meta data from the song’s header, leveraging this information to provide a more customized, personal user experience on a site or MP3 player

Download

Php Reports

Php Reports

A PHP framework for building Web applications for processing and displaying reports and statistics from any type of data sources

Download

Gantti

Gantti

An open source PHP graphing utility for creating Gantt charts, working using PHP and HTML 5 alone, with no JavaScript code at all

Download

[Practice] How to Send Data Between 2 Server with Curl

use-curl-to-send-data

I have two pieces of different servers IP and I want the server A can store data in MySQL database server B. step I take is give grant to server A (server address A) by registering the IP address in a remote MySQL server B , so that the server B is recognized and granted.

The measures mentioned above it seems easy, but when all is in perfect settings, they do not work and the exchange of data could not be done. Failed.

Is there another way to send data between the server?

Then, I tried using CURL. PHP This feature allows us to send data with POST method with a simple interface. CURL could be assumed as a full browser, you can provide the name of the browser, for example the name of the engine  firefox (agent) or google chrome. Curl can send the POST or GET method. More information about the curl can be read here. Generally, each server has a feature curl.
Ok, back to coding. We will create a function to make it easier.

function post_to_url($url, $data) {
   $fields = '';
   foreach($data as $key => $value) { 
      $fields .= $key . '=' . $value . '&'; 
   }
   rtrim($fields, '&');

   $post = curl_init();

   curl_setopt($post, CURLOPT_URL, $url);
   curl_setopt($post, CURLOPT_POST, count($data));
   curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
   curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);

   $result = curl_exec($post);

   curl_close($post);
   
}

Then, we can use these functions in this way

<?php
$data =array(
 'foo'=>'bar',
 'fruit'=>'apple'
);
post_to_url("http://serverB.com/getdata.php", $data);
?>

Then, we will create a file with the name getdata.php placed in the server B.

<?php
 $foo=$_POST['foo'];
 $fruit = $_POST['fruit'];

///-- save to your database

?>

You can capture data that has been sent from the server A and then put it into a database. Simple right?

Resource

  1. Bavotasan blog
  2. Davidwals Blog
  3. Stack overflow

Best Laravel Tutorial for Beginners

laravel tutorial

Laravel is PHP framwork which began to rise in popularity. Laravel began to be used by many programmers around the world today. Generally, they want to try new things, and it turns out that this framework has the potential of nice to be developed. So, laravel is a pleasant framework, the goal is to make the web development process more fun and entertaining, there is no longer a headache because the code is difficult. Yes, the development of the laravel it easier.

Want to try using Laravel? ok, you’re in the right place. This post will guide you learn so many laravel tutorials from beginner, intermediate and expert. As with my previous post about the tutorial photoshop and illustrator

Here, 10 laravel tutorial  to become a master of laravel framework. Read more

Best Restful Micro PHP Framework with Code Example and Tutorial

best restfull micro php frameworkCreating a web service without framework is very hard. Web service is an application that can be accessed via the URL or Restful. Most web service use restful  to interact with client, the reason is easy to use and simple. You can open a web service easily. With restfull micro PHP framework, you can build a web service quickly, easy and secure. There are many options restfull PHP framework you can choose, in the list below I put together a few restful micro PHP framework, completed with example code.

For example,  you want to create a web service to serve real- time data transport in a town. This web service can be accessed from anywhere, even can be accessed via mobile devices. You can also open a commercial web service, for example, the data soccer live, premium content networks like newscreed and others.

Restful micro PHP framework is certainly not a big framework, and may not be implemented for a large project. This framework is suitable for learning, however, you can still use this framework to a real project in real life. Read more

Newbie Tips : How to Use Bootstrap with CakePHP

formated text

CakePHP is a popular framework that is widely used by web developers and has an active community, which is constantly developing. Until now, CakePHP has reached version 3.0 dev3. I prefer to use the stable version, which is version 2.4. In version 3.0, reportedly many added features and a completely new, so we as developers are very easy to create sophisticated web. Check our snippet code for cakephp

CakePHP is a machine, you must creating a style manually. For that, I usually combine CakePHP with Bootstrap. Bootstrap is a CSS framework issued by twitter. Well, this post will explain how to combining Cakephp with bootstrap.

This is actually very simple, just add a CSS and javascript files. But for beginners, may find it difficult. Read more

Useful Codeigniter Module for Developers 2015

CodeIgniter Pagination Library

CodeIgniter is popular PHP framework and widely used by web developers, the benefits of this framework because it is easy to use, simple and has a good performance, even one of the framework with a small memory resource.

With CodeIgniter, developers can develop web applications, ranging from blogs to enterprise application systems used by large companies.

Codeigniter easy to develop because possess a feature called the module. Module is an additional program that can improve application performance, as wordpress plugin and jquery plugins.

Because it is very useful, I tried to gather useful CodeIgniter module to be easy to find. Please bookmark this URL of the blog post.

CodeIgniter-cURL

A PHP CodeIgniter library which makes it easy to do simple or complex cURL requests

It supports all the normal HTTP requests usually used on a website.

Download

CodeIgniter Pagination Library

CodeIgniter Pagination Library

A CodeIgniter library implementing a fully-customizable pagination system that lets you split long-winded content across multiple pages

The CodeIgniter Pagination Library was built to work with entries stored inside a database, allowing the developer to control the flow of information dumped on each page.The library, besides just splitting long content across multiple pages, also comes with a visual GUI for navigating them, a simple pager component that can be deployed with ease.This pager is a page number navigation system, with adjacent controls for jumping to the next, previous, first and last entry.The CodeIgniter Pagination Library pager can easily be localized to any language and developers are in full control over the number of entries to show on each page listing.

Download

flexi auth

flexi auth

A CodeIgniter library for managing a site’s userbase, the tool you need if you plan to let users register and login on your site

flexi auth can be used for running a community-powered CodeIgniter installation, supporting a special section in your site where users can make new accounts and where they can login into them.Along with the frontend part there’s also a backend where admins can manage the user accounts along with their permissions, granting them access to various site features, even admin privileges.fexi auth comes packet with lots of features, making ideal for a wide range of use cases.

Download

ci-syntax-highlight

A CodeIgniter plugin for adding source code syntax highlighting capabilities to a CI application, with support for various programming languages and highlighting themes

Using the Luminous PHP library adapted to the CodeIgniter plugin system, ci-syntax-highlight allows editors to include code blocks, declare their programming language, and have the source code automatically highlighted when embedded on the frontend.This lets developers properly show source code with their content, with an improved degree of readability and attuned to the site’s general UI style.Since ci-syntax-highlight is a packaged version of Luminous, all its original features are also supported with the CodeIgniter plugin, and small tweaks can be made here and there.Usage instructions are provided with the package’s README file.

Download

CI-Merchant

 

A CodeIgniter plugin that implements a driver-based payment processing toolkit for using with any CodeIgniter-powered app or website

CI-Merchant is nothing more than a gateway-agnostic payment system on which various billing providers can be integrated.It comes with support for various known gateways out of the box, but with the provided documentation, additional custom services can be added with ease.Installation via the CodeIgniter Sparks auto-installer is supported.

Download

Codeigniter twitter tweets

Codeigniter twitter tweets

CodeIgniter plugin for embedding Twitter data

The plugin makes use of Twitter’s API for embedding tweets in remote locations.It’s perfect for showcasing a person’s social activity, while keeping a hold on what’s OK to display and what’s not.

Download

visualCaptcha for CodeIgniter

visualCaptcha for CodeIgniter

A tiny CodeIgniter plugin for adding visual and audio CAPTCHA fields to your online forms, complete with mobile and Retina support

This plugin was ported from the visualCaptcha PHP library.The CodeIgniter version tries to follow as closely as possible the original guidelines, supporting most of the features and the original design patterns that have been so successful in protecting forms from a wide variety of spam bots.Besides the original features referring to the mobile, visual, audio and drag&drop support, the CodeIgniter plugin also adds specific support for using the CAPTCHA with specific CodeIgniter projects.This includes support for translatable text and easy embedding with CI Views and Controllers.visualCaptcha is also available for: PHPNode.jsRuby (official) Ruby (unofficial) WordPress

Download

Highchart library for Codeigniter

 

A CodeIgniter plugin for rendering graphs using the Highcharts JS library

The library allows CodeIgniter admins to render their charts via the famous Highcharts JavaScript charting library.Supports all chart types supported by the Highcharts library (bar, pie, line, spline, area, areaspline, column and scatter).

Download

MailChimp-for-CodeIgniter

A simple CodeIgniter plugin for the MailChimp API

MailChimp is a online service which can be used to manage, send and track customer newsletters and email marketing campaigns.Written in PHP, the library allows CodeIgniters developers to remotely interact with the MailChimp service.Supports modifying campaigns, auto-responders, templates, lists, etc..

Download

Codeigniter OAuth 2.0

CodeIgniter library for working with the newer version of the OAuth protocol

Supports version 2.x of the protocol.OAuth 2.x is split into 2 profiles, clients and providers. This library wraps the provider part for CodeIgniter.

Download

codeigniter-simple-uploadify

This is a CodeIgniter plugin for managing file uploads with Uploadify

Uploadify is a jQuery plugin that allows an easy way to integrate single or multiple file uploads on a website.This plugin allows CodeIgniter-developed apps to handle all file uploads via Uploadify, instead of the classic upload controller.A demo is included with the download package.

Download

Sitemaps for CodeIgniter

 

CodeIgniter plugin for creating XML sitemaps

This plugin will help CodeIgniter admins create a XML sitemap which they can promote on various search engines for increasing a site’s visibility on the Internet.This plugin will help CodeIgniter admins create a XML sitemap which they can promote on various search engines for increasing a site’s visibility on the Internet.

Download

Javascript-Loader-Helper

 

A lightweight and easy to use CodeIgniter library for automatically loading all JavaScript files found inside a designated folder

To use Javascript-Loader-Helper, just point the library at a folder and it will automatically load all JS files found inside.The folder path is customizable. and the library works best only in CodeIgniter apps where the same JS files are used everywhere on the site.

Download

Facebook Connect CodeIgniter Library

 

A library for the CodeIgniter PHP framework to integrate Facebook Connect in / on a web page

Essentially being a wrapper around the Facebook PHP API, it includes everything needed to get Facebook Connect working within CodeIgniter libraries.This library also allows to add XFBML to view files, call the Graph API via secure SSL (with CURL), and build richly connected applications with the Open Graph.

Download

CodeIgniter Amazon SES

 

A CodeIgniter plugin for interacting with the Amazon Web Services SES API

Amazon Web Services SES (Simple Email Service) is a highly scalable and cost-effective bulk and transactional email-sending service.This library allows apps developed on top of the CodeIgniter PHP framework to query and interact with Amazon SES from within PHP code.

Download

CodeIgniter Cache Helper

 

A library for adding extra tools to the CodeIgniter built-in cache system

The library’s purpose is to add some new tools for managing the cache files more easily.This allows a developer to manipulated outputted cache files via PHP.

Download

Bit.ly CodeIgniter Library

 

A PHP library for the CodeIgniter gallery to connect and use the Twitter API

This library provides an interface to Bit.ly’s API.Can be used by developers to send long links to Bit.ly’s service and retrieve a shortened version.The opposite operation is also possible.

Download

Alternative PHP Framework for Developers in 2015

Oro Platform

Most developers use cakephp, codeigniter and zend framework to create web applications. These framework is very solid and proven ability. But, it turns out there are many PHP frameworks that can be used as an alternative to large framework above. Perhaps, you will get a new experience with some frameworks that might sound familiar to you.
All this under the framework using PHP, I have not used a non-PHP framework. and kebanyakn based MVC.

TYPO3 Flow

 

An application framework for PHP, created to power up the famous TYPO3 CMS, but also perfectly safe to use for other projects as well

Download

Adventure PHP Framework

 

A web development framework that helps coders design and create object oriented and reusable PHP Web applications

Download

Stubbles

 

A lightweight and well-documented PHP 5 framework for developing modern Web-based applications following well-known industry standards

Download

SilverStripe Framework

 

A modern, object-oriented PHP framework based on the classic MVC (model-view-controller) architecture, ideal for developing complex PHP-based applications

Download

Nette Framework

 

An object-oriented PHP framework for creating Web applications, packaged with plugins, extensions and lots of developer-friendly utilities

Download

Mako Framework

 

A lightweight PHP 5 MVC framework

Download

Lumen

 

A PHP micro-framework that came out of the development work put into Laravel, ideal for smaller projects where speed is more important

Download

Jelix

 

A PHP 5 framework for developing any kind of web applications

Download

Silex

 

A PHP micro-framework based on Symfony2 components, the perfect tool for developing small-scale projects without the overhead of a larger framework

Download

Oro Platform

Oro Platform

A fully-featured PHP development platform (framework) for creating customizable Web-based applications in PHP 5.x and Symfony 2.x

Download

PHPixie

 

An open source PHP MVC micro-framework that can help developers out when deploying new projects, providing a solid base for their code

Download

MicroMVC

 

A PHP micro-framework specialized in offering optimal performance while still remaining as small as possible, coded following the MVC design paradigm

Download

Lithium

 

A PHP framework for developing solid web applications

Download

Horus Framework

 

An OOP PHP micro-framework, a lightweight toolkit to help developers lay down the foundation of their PHP-based websites and applications

Download

Warp Framework

Warp Framework

A powerful, fully-customizable, and well tested PHP framework developed by the fantastic YOOtheme team, perfect for building your own, customized Joomla and/or WordPress themes

Download

PSX Framework

 

An open source, object-oriented framework for developing dynamic websites in PHP, separating the application’s code from its design

Download

Aura Framework

 

A full-stack PHP framework composed of smaller packages

Download

Walrus

 

A very lightweight PHP MVC framework that contains only the basic utilities for you to quickly prototype and launch a Web application with

Download

LeiPHP

 

Lightweight framework for simplistic PHP apps

Download

FuelPHP

 

A fast, lightweight PHP 5.3 framework

Download

Fat-Free Framework

 

A complex PHP micro-framework for helping programmers create powerful Web applications, all at under 100 KB worth of PHP code

Download

Bullet

 

A PHP micro-framework ideal for developing smaller Web applications, using an unique development pattern and architecture structure

Download

Phalcon PHP

 

A PHP framework for developing web applications

Download

[Solved] Warning 512 Invalid Salt on CakePHP when Use Blowfish Encryption

cakephp-blowfish-error

CakePHP has a complete feature to create a simple authentication or system login / logout. Although simple, but the quality of security sufficient for modern websites. If you want to learn to make the authentication system, please follow the tutorials available on this page. I also followed him, and succeeded perfectly.

However, there is a bit of a problem, that is, when you use a hash or encryption method different password other than blowfish. Yes, on the tuturial, cakephp using blowfish hash method. If you fill in the password by methods other than blowfish, then you will get an error like this.

cakephp blowfish error

Dont worry, the problem is not your system or cakephp or PHP version. However, for the PHP version, make sure you are using version 5.3 and above. I am using PHP version 5.5.3 and no problems.

The problem is, you use a different password hash method with blowfish, for example md5. I’m using MD5 and there was an error as above.

Ultimate Tutorial Using Medoo PHP Framework

medoo tutorial

Medoo is a PHP framework that interesting to me. Why? because this framework is very small, only a few kilobytes, and only 1 piece of file. I call Medoo is a real micro PHP framework. Medoo has primary responsibility only interact with the database, no helpers and controllers, so right if Medoo referred to as non-MVC framework.

With Medoo we can interact with databases, especially MySQL very easily and quickly, because in the framework Medoo there are many functions for it. Suppose the function select, insert, update and delete. Isn’t the basic operation of the database is CRUD? so, this framework already qualified. Instead you use PHP from scratch, it is better to use this framework.

[code tipe=”336″]

Medoo made ​​by Angel Lai, someone who likes things simple and easy.

This post about tutorial use Medoo, from starting to advance. We learn together

1. Setting up Your Medoo Framework

Please download a copy of Medoo, you can download it via this link (minify version, recomended for production) or this link (when development app). Store it on you local drive and you ready to follow this tutorial.

Setting up your MySQL database

Open medoo.php file, edit some code below, make sure you know your database configuration.

protected $database_type = 'mysql';
protected $server = 'localhost';
protected $username = 'your_username';
protected $password = 'your_password';

Please fill according to your database. I think you’ll have no trouble doing it. Ok, save and you’re done,  medoo connect with the database perfectly.

[code tipe=”300″]

2. Select Query

We could easily do the select query to a database via medoo framework. Sample code is as below

$database = new medoo();
 
$datas = $database->select("account", [
	"user_name",
	"email"
], [
	"user_id[>]" => 100
]);

Select all column in account table

$datas = $database->select("account", "*");

or select a column in account table

$datas = $database->select("account", "user_name");

and then print data from database in your browser

[code tipe=”728″]

foreach($datas as $data)
{
	echo "user_name:" . $data["user_name"] . " - email:" . $data["email"] . "<br/>";
}

Easy to do following this tutorial? yes, because medoo very easy to learn and use. Ok, now for the next tutorial that is, insert data into the database.

3. Insert Record to Database

$database = new medoo();
 
$last_user_id = $database->insert("account", [
	"user_name" => "foo",
	"email" => "[email protected]",
	"age" => 25
]);

Of course, we can insert multiple record in one action

$last_user_id = $database->insert("account", [
[
	"user_name" => "foo",
	"email" => "[email protected]",
	"age" => 25,
	"city" => "New York"
],
[
	"user_name" => "bar",
	"email" => "[email protected]",
	"age" => 14,
	"city" => "Hong Kong"
]);

So, we do not need a looping command.

4. Update Command

$database->update("account", [
 "name"=>"John Doe",
 "phone"=>"0984758"
  ],
  [
"user_id"=>10
]);

easy and simple lines of code, you can also play with it.

[code tipe=”link”]

5. Delete Command

$database = new medoo();
 
$database->delete("account", [
	"AND" => [
		"type" => "business"
		"age[<]" => 18
	]
]);

That’s a brief tutorial using Medoo framework. I will update this tutorial when finished with my affairs.