PHP date difference calculation

PHP date difference calculation code.

PHP version >= 5.3.0

PHP version 4 and 5 (recommended only for PHP < 5.3.0).
Please note the below code snippets do not handle time zones or leap years.

More accurate PHP date difference calculator (below PHP 5.3.0) :

 

Create bootable OS X Maverick USB Flash Drive

Create bootable OS X Maverick USB Flash Drive from original App Store Mavericks 10.9 package. There are two methods to create a bootable Mavericsks on a USB pend drive:

Method 1:

1) Erase a minimum 8GB USB pen drive using Disk Utility* and ensure it’s named ‘Untitled’ and Mac OS Extended (Journaled) format.

2) Download OS X Mavericks from the Mac App Store. It’ll download and save to the Applications folder automatically. Furthermore, after it’s finished downloading, it may automatically begin the install process. If this happens, just quickly cancel it.

3) Run the below command in Terminal** window:

sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction

4) Type your current user password.

The application will erase your USB pen drive first, then write Mac OS X Mavericks files making it bootable. The result of burning image into USB should be as follows:

Password:
Erasing Disk: 0%… 10%… 20%…100%…
Copying installer files to disk…
Copy complete.
Making disk bootable…
Copying boot files…
Copy complete.
Done.

Method 2 (for those that got “Failed to start erase of disk due to error (-9999, 0)”):

Some people struggle to create a bootable Mavericks on a USB thumb drive and get “Failed to start erase of disk due to error (-9999, 0)” error message. If you are one of them try the below steps:

  1. You are going to need to see some hidden files for this.  So start by opening Terminal.app** and pasting in the following (don’t worry, we’ll undo this change when we are done)…
    defaults write com.apple.Finder AppleShowAllFiles YES
    killall Finder
  2. If you haven’t already done it, download the Mac OS X Mavericks 10.9 installer as normal from the app store.
  3. After download you will have the ‘Install OS X 10.9′ app in your /Applications folder. Right-click it and select ‘Show Package Contents’.
  4. Navigate to the Contents/SharedSupport. There you will see the InstallESD.dmg file.  Unfortunately, you can’t just grab it and restore it.  Instead double-click it to mount it.
  5. You should now see the normally hidden BaseSystem.dmg file in the mounted volume.
  6. Open Disk Utility* and restore the source BaseSystem.dmg to the destination of your USB drive.
  7. Now open up the restored USB volume (default name is OS X Base System) and navigate to System/Installation. In there you will see an alias for Packages. Delete this alias.
  8. Copy the full Packages folder from the root of the mounted InstallESD volume (the same place you got the BaseSystem.dmg file) to the USB volumes System/Installation folder. Basically, replace the Packages alias you just deleted with the real Packages folder from the original InstallESD volume.
  9. The USB drive should now be bootable. So simply restart, hold down the Option key (Alt) when booting with the USB drive in your machine, and you should get the option to boot from the USB drive.
  10. Remember, to rehide the normall hidden files just repeat step 1 but change YES to NO.


* – in order to run Disk Utility press CMD + Space, type Disk Utility and click/select to run. Alternatively go to Applications > Utilities, find and run Disk Utility from there.
** – in order to run Terminal press CMD + Space, type Terminal and click/select to run. Alternatively go to Applications > Utilities, find and run Terminal from there.

Date time picker

Date time picker

There are many to choose from. Some offer only date picker, others provide both date and time separately. There are few that combine date and time in one selector such as bootstrap-datepicker by eternicode. You choose which one will work for you:

jQuery native date picker

The jQuery UI Datepicker is a highly configurable plugin that adds datepicker functionality to your pages. You can customize the date format and language, restrict the selectable date ranges and add in buttons and other navigation options easily.

http://jqueryui.com/datepicker

Keith Wood iQuery date pick

A jQuery plugin that attaches a popup calendar to your input fields or shows an inline calendar for selecting individual dates or date ranges.

http://keith-wood.name/datepick.html

Twitter Bootstrap: An extended date and time picker

Date time picker utilizing Twitter Bootstrap framework. It provides a very neat and user friendly date and time calendar selector through one field/pop up.

http://tarruda.github.io/bootstrap-datetimepicker

Twitter Bootstrap: An extended date picker

https://github.com/eternicode/bootstrap-datepicker

Zebra Datepicker, a lightweight datepicker plugin based on jQuery

Zebra_Datepicker is a small, compact and highly configurable datepicker jQuery plugin, meant to enrich forms by adding the datepicker functionality to them. This jQuery plugin will automatically add a calendar icon to the indicated input fields which, when clicked, will open the attached datepicker. Users can easily jump between months and years due to the datepicker’s intuitive interface. The selected date will be entered in the input field using the date format of choice, configurable in the datepicker’s options.

Features:

  • small – it weights around 21KB minified
  • compact – unlike other datepickers, this datepicker is one-file only
  • cross-browser – works in every major browser; works also in Internet Explorer 6 where it uses an iFrameShim to stay above select controls
  • default color scheme that blends-in well with almost any design, and it’s easily
  • customizable through the well-organized CSS file; two additional themese are included, one of them being for use with Twitter Bootstrap
  • intuitive interface fast and easy navigation through months and years
  • intuitive mechanism for disabling dates and date ranges using a syntax similar to cron‘s syntax
  • supports defining of custom weekend days for countries that don’t have the weekend on Saturday and Sunday
  • supports most of date formats you can think of, borrowing the syntax of PHP’s date function
  • supports all sorts of combinations for starting and ending dates
    date pickers can be “paired” – where one or more date pickers will use the value of another date picker as starting date
  • supports internationalization
  • works by automatically attaching a small calendar icon to the indicated input fields which displays the attached datepicker when clicked.
  • Thanks to Aeron Glemann for building a datepicker for MooTools where he came up with the idea of disabling dates using a syntax similar to cron’s!

http://stefangabos.ro/jquery/zebra-datepicker

Web / www folder permissions – multiple users group access

How to set up correctly linux www folder permissions on a web server.

A quick setup allowing to set correct web folders permissions on a web server granting write access to users belonging to a specified group.

Please note that in order to separate users permissions multiple groups are required and this quick tutorial doesn’t cover such scenario.

Step1: Add users to your web server group

You can find out which group folders and files belong to by simply running:
ls -la

This should show a list where 4th column indicates group name eg:

-rw-r–r–  1 john developers    244 Jan 21 16:06 index.htm

In the above example ‘developers’ is the group name and ‘john’ user belonging to it. So, the file belongs to ‘john’ but also users in ‘developers’ group will have access to it.

On Linux Centos 6.3 by default apache adds web folder to ‘www-data’ group. Therefore, I will add users that should have access to it to this group:

sudo usermod -a -G www-data user1

Now, once we have user added to our web group called ‘www-data’ which is owned by user with exactly the same name it’s time to enforce all new content created under your web directory to belong to ‘www-data’ group as well so both users and web server can access it.

Step 2: Change folders permission recursively

Go to your web folder where web sites reside (e.g. cd /var/www) and run:

chmod 2774 -R .

All folders’ permissions inside your web directory should now look like:

drwxrwsr–  1 john www-data    244 Mar 12 11:34 somesitefolder.com

In order to remove users from groups use:

gpasswd -d user group

Git server installation

Install git package on your server (google install git server OS_NAME)

# ssh into your server and run the following commands:

$ sudo adduser git
$ su git
$ mkdir .ssh

#If you haven’t already done so already generate ssh keys on your local client machine:

$ ssh-keygen -t rsa -C “your_email@example.com”

# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
# Enter file in which to save the key (/path_to_your_home_folder/.ssh/id_rsa): [Press enter]…

# copy contents of id_rsa.pub into memory
# back on your server server
$ vi ~/.ssh/authorized_keys
# press letter i and paste (CTRL + V or CMD +V)
# press : (colon) then type wq and enter

# Now it’s time to create some git repo(s) where you’ll push your code:
# Firstly, repo creation on your server:

$cd ~
$ mkdir project.git
$ cd project.git
$ git –bare init

# Back on your client create new git local repo:

$ mkdir project.git
$ cd project.git
$ git init

# Commit your current structure or files you add:

$ git add .
$ git commit -m ‘initial commit’

# add remote repo on your server so local git knows where to push:
$ git remote rm origin
$ git remote add origin git@gitserver:/opt/git/project.git
$ git push origin master

Note: if you are logged in as different user than git on your client you’ll be asked for a password each time you push/fetch/pull from the server. You can set one by running on the server:

#sudo passwd git

Otherwise it should not prompt for any.

Git aliases

Useful git aliases:

#create “cm” alias for “commit”
git config alias.cm commit

#create “co” alias for checkout
git config alias.co checkout

#make “br” alias for branch
git config alias.br branch

# create alias for diff
git config alias.df diff

# create alias for status
git config alias.st diff

# When you want to see just the differences of one function in one file in two different commits:
git config alias.funcdiff ‘!sh -c “git show \”\$1:\$3\” | sed -n \”/^[^ \t].*\$4(/,/^}/p\” > .tmp1 &&
git show \”\$2:\$3\” | sed -n \”/^[^ \t].*\$4(/,/^}/p\” > .tmp2 &&
git diff –no-index .tmp1 .tmp2″‘ –

English while vs. whilst

English ‘while’ and ‘whilst’

Both of these words have the same meaning and can be used interchangeably.

Some dictionaries deem whilst as an older or archaic version thus obsolete/deprecated. However, it’s still quite popular in academic, formal text or poetic writing.

Certain sources proclaim that in times of Middle English, the suffix -s was often appended to words in order to indicate the use of an adverb e.g. an even less common whiles. As the English language evolved, confusion arose and superlatives started to mismatch thus causing conversion of –s endings to –st.

Using while you won’t ever be wrong, whereas whilst can easily look out of place.
From purely geographical perspective, while is commonly used across all countries whereas whilst mainly in British. Though, more in writing than speech presumably due to its pronunciation.

PHP Integrated Development Environment (IDE)

An Integrated Development Environment (IDE) or interactive development environment is a software application that provides comprehensive facilities to computer programmers for software development. So the wikipedia.org states.

I’ve compiled a list of the most popular IDEs allowing to evaluate and decide which one works best for your project / suits needs.

Aptana Studio

Build web applications quickly and easily using the industry’s leading web application IDE. Aptana Studio harnesses the flexibility of Eclipse and focuses it into a powerful web development engine.

http://www.aptana.com

Bluefish

Bluefish is a powerful open source editor targeted towards programmers and web developers, with many options to write websites, scripts and programming code. Bluefish supports many programming and markup languages.  It’s a multi-platform application that runs on most desktop operating systems including Linux, FreeBSD, Mac OS X, Windows, OpenBSD and Solaris released under the GNU GPL licence.

http://bluefish.openoffice.nl/

CodeLobster

A multifunctional portable IDE, absolutely FREE with all standard features:
PHP/HTML/CSS/JavaScript highlighting, advanced PHP/HTML/CSS/JavaScript autocomplete, Powerful PHP debugger, Context and Dynamic Help, Code Validator, SQL manager and much more…

http://www.codelobster.com/

Dreamweaver*

Develop more web content, more quickly. A streamlined user interface, connected tools, and new visual CSS editing tools let you code efficiently and intuitively. And now, Dreamweaver® CC lets you share work directly from within the application, and helps you keep up with web standards by giving you access to new features as soon as they’re available. Your entire creative world, together in one place.

http://www.adobe.com/dreamweaver

Eclipse: PDT

The PHP IDE project delivers a PHP Integrated Development Environment framework for the Eclipse platform. This project encompasses the development components necessary to develop PHP-based Web Applications and facilitates extensibility. It leverages the existing Web Tools Project in providing developers with PHP capabilities.

http://www.eclipse.org/pdt

Edit Plus

EditPlus is a text editor, HTML editor, PHP editor, Java editor and Hex Viewer for Windows. While it can serve as a good Notepad replacement, it also offers many powerful features for Web page authors and programmers.

  • Syntax highlighting for HTML, PHP, Java, C/C++, CSS, ASP, Perl, JavaScript, VBScript, Python and Ruby on Rails. Also, it can be extended for other programming languages based on custom syntax files.
  • Seamless Web browser for previewing HTML pages, and FTP commands for uploading local files to FTP server.
  • Other features include Hex Viewer, HTML toolbar, user tools, line number, ruler, URL highlighting, auto completion, cliptext, column selection, powerful search and replace, multiple undo/redo, spell checker, customizable keyboard shortcuts, and more.

http://www.editplus.com

Emacs

GNU Emacs is an extensible, customizable text editor—and more. At its core is an interpreter for Emacs Lisp, a dialect of the Lisp programming language with extensions to support text editing. The features of GNU Emacs include:

  • Content-sensitive editing modes, including syntax coloring, for a variety of file types including plain text, source code, and HTML.
  • Complete built-in documentation, including a tutorial for new users.
  • Full Unicode support for nearly all human languages and their scripts.
  • Highly customizable, using Emacs Lisp code or a graphical interface.
  • A large number of extensions that add other functionality, including a project planner, mail and news reader, debugger interface, calendar, and more. Many of these extensions are distributed with GNU Emacs; others are available separately.

http://www.gnu.org/software/emacs/

jEdit

jEdit is a mature programmer’s text editor with hundreds (counting the time developing plugins) of person-years of development behind it. To download, install, and set up jEdit as quickly and painlessly as possible, go to the Quick Start page.

The jEdit core, together with a large collection of plugins is maintained by a world-wide developer team. Some of jEdit’s features include:

  • Written in Java, so it runs on Mac OS X, OS/2, Unix, VMS and Windows.
  • Built-in macro language; extensible plugin architecture. Hundreds of macros and plugins available.
  • Plugins can be downloaded and installed from within jEdit using the “plugin manager” feature.
  • Auto indent, and syntax highlighting for more than 200 languages.
  • Supports a large number of character encodings including UTF8 and Unicode.
  • Folding for selectively hiding regions of text.
  • Word wrap.
  • Highly configurable and customizable.
  • Every other feature, both basic and advanced, you would expect to find in a text editor.

http://www.jedit.org/

Komodo

Komodo is the professional IDE for major web languages, including Python, PHP, Ruby, Perl, HTML, CSS and JavaScript. You’ll enjoy developing faster with Komodo IDE’s complete set of tools.

  • Code folding, split view, multi-window editing, smart syntax checking and highlighting
  • Debug PHP, Python, Perl, Ruby, Tcl, Node.js. Local and remote. HTTP Inspector.
  • Lighter User Interface: New, cleaner UI. Undock and move side panes. Scroll code via minimap.
  • Team Capabilities: Multi-user editing, Stackato Platform-as-a-Service, shared toolbox, version control integration.
  • Code Intelligence: Auto-complete and calltips for many languages. Navigate code structure with Code Browser.
  • Integrated Tools: Subversion, Mercurial, Git, Perforce, Bazaar, CVS support. Unit testing. Database Explorer.Add-Ons and Customization: Vi, emacs key bindings out-of-the-box. Customize, extend with over 100 add-ons.
  • Cross-Platform: Identical features for Mac, Linux and Windows. User-based license: you can install on as many computers and platforms as you use.

http://www.activestate.com/komodo-ide

NetBeans

NetBeans IDE empowers developers to create and debug rich web and mobile applications using the latest HTML5, JavaScript, and CSS3 standards. Developers can expect state of the art rich web development experience with a page inspector and CSS style editor, completely revamped JavaScript editor, new JavaScript debugger, and more. Additional highlights include continued enhancements to the IDE’s support for Groovy, PHP, JavaFX and C/C++. New PHP related features highlights:

  • Parsers for Namespaced Annotations (Symfony 2, Doctrine 2, etc.)
  • Basic Composer Integration (Dependency Manager for PHP)
  • Twig Code Completion (with documentation)
  • Smarty Braces Matching for Related Tags
  • Smarty Support, Parser Errors of Unmatched Tags
  • Profiler: Sampled memory profiling, CPU snapshots comparison, support for Linux ARM machine.

http://netbeans.org

Notepad++

Notepad++ is a free source code editor and Notepad replacement that supports several languages. Running in the MS Windows environment, its use is governed by GPL License.

Based on the powerful editing component Scintilla, Notepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size. By optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting in a greener environment.

http://notepad-plus-plus.org/

phpDesigner

phpDesigner 8 is an all-in-one solution for your web-development. Build tomorrow’s website and apps with this full-featured PHP editor  and PHP IDE with built-in editors for HTML5-, CSS3- and JavaScript!

  • Create, edit, debug, analyze and publish PHP, HTML5, CSS3 and JavaScript
  • Speed up your coding with tons of time-saving features
  • Support all PHP frameworks e.g. Zend, CodeIgniter, Yii, Symfony and Prado
  • JavaScript frameworks jQuery, Ext JS, Dojo, MooTools, Prototype and others

phpDesigner 8 is for developers who wants to create good looking websites, HTML5 web apps or just improve their coding skills.

http://www.mpsoftware.dk/

PhpED

NuSphere is provider of the best PHP Tools, the home of PhpED – state of the art PHP Editor. Thousands of people use our tools including our PHP IDE with the leading debugging tool for PHP.

http://www.nusphere.com

PhpStorm

  • Support for PHP 5.3 and 5.4 for modern and legacy projects
  • Code autocompletion, refactorings, on-the-fly error prevention, supports language mixtures and more.
  • Code Quality Analysis
  • Typed code inspections / verification , analyzing the whole project.
  • PHPDoc support, code (re)arranger, code formatter with code style configuration and other features help you write neat code that’s easy to support.
  • Version Control Systems integration (Git, Mercurial, SVN, etc), local history, support for remote deployment, SQL and databases, Composer, PHP UML, and integrated REST Client.
  • Zero-configuration debugging.
  • PHPUnit testing support right from the IDE.
  • Profile your applications with Xdebug or Zend Debugger and check aggregated reports in PhpStorm.
  • All the cutting edge web development technologies are supported including HTML5, CSS, SASS, SCSS, LESS, CoffeeScript, ECMAScript Harmony, Jade templates, Zen Coding, Emmet, and of course JavaScript, with refactorings, debugging and unit-testing.
  • Single license key allows to run your IDE on any Windows, Mac OS or Linux.

http://www.jetbrains.com/phpstorm/

Sublime text

Sublime Text is a sophisticated text editor for code, markup and prose. You’ll love the slick user interface, extraordinary features and amazing performance.

  • Goto Anything to open files with only a few keystrokes, and instantly jump to symbols, lines or words.
  • Multiple Selections to make ten changes at the same time, not one change ten times.
  • Command Palette holds infrequently used functionality, like sorting, changing the syntax and changing the indentation settings so you don’t have to look for them deep through the menus or remember obscure key bindings.
  • Distraction Free Mode to help you out when you need to focus.
  • Wide or multiple-monitors split editing support.
  • Instant Project Switch automatically saves your current work with no extra prompt for action allowing to come back to its latest state.
  • Customize Anything e.g. key bindings, menus, snippets, macros, completions and more with simple JSON files.
  • Python based plugin API along with a built in Python console to interactively experiment in real time.
  • Cross-platform available for OS X, Windows and Linux.

http://www.sublimetext.com

TextMate

TextMate brings Apple’s approach to operating systems into the world of text editors. By bridging UNIX underpinnings and GUI, TextMate cherry-picks the best of both worlds to the benefit of expert scripters and novice users alike.

  • Ability to Search and Replace in a Project
  • Auto-Indent for Common Actions Like Pasting Text
  • Auto-Pairing of Brackets and Other Characters
  • Clipboard History
  • Column Selections and Column Typing
  • Completion of Words from Current Document
  • CSS-like Selectors to Pinpoint the Scope of Actions and Settings
  • Declarative Language Grammars for Graceful Mixing and Hacking
  • Dynamic Outline for Working With Multiple Files
  • Expand Trigger Words to Code Blocks With Tab-able Placeholders
  • File Tabs when Working With Projects
  • Foldable Code Blocks
  • Function Pop-up for Quick Overview and Navigation
  • Plug-able Through Your Favorite Scripting Language
  • Recordable Macros With No Programming Required
  • Regular Expression Search and Replace (grep)
  • Run Shell Commands from Within a Document
  • Support for Darcs, Perforce, SVK, and Subversion
  • Support for More Than 50 Languages
  • Switch Between Files in Projects With a Minimum of Key Strokes
  • Themable Syntax Highlight Colors
  • Visual Bookmarks to Jump Between Places in a File
  • Works As External Editor for (s)ftp Programs
  • Works Together With Xcode and Can Build Xcode Projects

http://macromates.com

Vim

Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems.

http://www.vim.org

Visual Studio*

Microsoft Visual Studio provides many new capabilities to support development on the latest platforms with modern lifecycle tools to make it easier for teams to deliver value continuously. Visual Studio Updates help ensure you always have the best solution for building modern applications and for managing the modern application lifecycle.

http://www.microsoft.com/visualstudio

Xcode

Xcode is Apple’s powerful integrated development environment for creating great apps for Mac, iPhone, and iPad. Xcode includes the Instruments analysis tool, iOS Simulator, and the latest Mac OS X and iOS SDKs.

The Xcode interface seamlessly integrates code editing, UI design with Interface Builder, testing, and debugging, all within a single window. The embedded Apple LLVM compiler underlines coding mistakes as you type, and is even smart enough to fix the problems for you automatically.

http://developer.apple.com/xcode/

Zend Studio*

Zend Studio is the only Integrated Development Environment (PHP IDE) designed for professional developers that encompasses all the development components necessary for the full PHP application lifecycle.

  • Build complete cloud-connected mobile apps
  • Develop faster and more productively
  • Write Zend Framework 2 code more efficiently
  • Develop in the Cloud with Red Hat or Zend Developer Cloud
  • Use the latest PHP release and the latest Eclipse platform
  • Now includes 12 months of support and upgrades

http://www.zend.com/products/studio/

PHP REST API Frameworks

What is the best PHP RESTful API Framework for my project?

A number of articles on websites strive to give directions which RESTful API frameworks should be chosen whereas in fact there is no “one fits all” solutions that suit different purposes or technologies. Another question is whether to go for Model-View-Controller (MVC) or Resource-Method-Representation (RMR) model.
Therefore, herewith a compiled list of some most popular and actively developed PHP REST API frameworks worth consideration and further evaluation on your project basis:

Epiphany

The Epiphany framework is fast, easy, clean and RESTful. The framework does not do a lot of magic under the hood. It is, by design, very simple and very powerful.

The documentation provides a few conventions that we believe lead to well written code but you’re free to use any style you’d like. The framework never dictates how you should write or structure your application.

https://github.com/jmathai/epiphany

Fat Free

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust web applications – fast!

  • Super lightweight code base with just ~55kb
  • Full-featured toolkit
  • Easy to learn, use and extend
  • Fast and clean template engine
  • Unit testing toolkit
  • Database-managed sessions
  • Markdown-to-HTML converter
  • Atom/RSS feed reader
  • Image processor
  • Geodata handler
  • On-the-fly Javascript/CSS compressor
  • OpenID (consumer)
  • Custom logger
  • Basket/Shopping cart
  • Pingback server/consumer
  • Unicode-aware string functions
  • SMTP over SSL/TLS
  • Tools for communicating with other servers
  • Data Validation
  • and more Plugins from the F3-Community

http://fatfreeframework.com

Flight

Flight is a fast, simple, extensible framework for PHP. Flight enables you to quickly and easily build RESTful web applications.

http://flightphp.com

Frapi

Frapi is a  high-level PHP REST API framework that powers web apps, mobiles services and legacy systems, enabling a focus on business logic and not the presentation layer.
FRAPI handles multiple media types, response codes and generating API documentation. It was originally built by echolibre to support the needs of their client’s web apps, and now it’s been open-sourced.

http://getfrapi.com/

Guzzle

Guzzle takes the pain out of sending HTTP requests and the redundancy out of creating web service clients. It’s a framework that includes the tools needed to create a robust web service client, including: Service descriptions for defining the inputs and outputs of an API, resource iterators for traversing paginated resources, batching for sending a large number of requests as efficiently as possible.

  • All the power of cURL with a simple interface.
  • Persistent connections and parallel requests.
  • Streams request and response bodies.
  • Service descriptions for quickly building clients.
  • Powered by the Symfony2 EventDispatcher.
  • Use all of the code or only specific components.
  • Plugins for caching, logging, OAuth, mocks, and more.
  • Includes a custom node.js webserver to test your clients.

http://guzzlephp.org

Kohana

An elegant HMVC PHP5 framework that provides a rich set of components for building web applications.

  • Many common components are included: translation tools, database access, code profiling, encryption, validation, and more.
  • Use specific libraries and tools: extending existing components and adding new libraries is very easy.
  • Write commercial applications: uses the BSD license, so you can use and modify it for commercial purposes.
  • A very fast framework: benchmarking a framework is hard and rarely reflects the real world, but Kohana is very efficient and carefully optimized for real world usage.
  • Good debugging and profiling tools: simple and effective tools help identify and solve performance issues quickly.
  • Know what the framework is doing: very well commented code and a simple routing structure makes it easy to understand what is happening.
  • Work with objects and classes: an OOP framework that is extremely DRY. Everything is built using strict PHP 5 classes and objects.
  • Write your own code: there are no code generators and endless configuration files, so setting up is fast and easy.
  • Community support: a very active community forum and IRC channel means that most questions are answered very quickly.

http://kohanaframework.org

Laravel

Laravel is a clean and classy framework for PHP web development. Freeing you from spaghetti code, Laravel helps you create wonderful applications using simple, expressive syntax. Development should be a creative experience that you enjoy, not something that is painful. A well written documentation is a big plus.

Advantages over other frameworks:

  • Bundles
  • The Eloquent ORM
  • Application Logic
  • Reverse Routing
  • Restful Controllers
  • Class Auto Loading
  • View Composer
  • The Inversion of Control (IoC) container
  • Migrations
  • Unit-Testing
  • Automatic Pagination

http://laravel.com

Lumen (Laravel based micro-framework)

Lumen is the perfect solution for building Laravel based micro-services and blazing fast APIs. In fact, it’s one of the fastest micro-frameworks available. It has never been easier to write stunningly fast services to support your Laravel applications.

Advantages over other frameworks:

  • Super-fast
  • Eloquent features available

http://lumen.laravel.com/

Phalcon

Phalcon is an open source, full stack framework for PHP 5 written as a C-extension, optimized for high performance. You don’t need to learn or use the C language, since the functionality is exposed as PHP classes ready for you to use. Phalcon also is loosely coupled, allowing you to use its objects as glue components based on the needs of your application.

Phalcon is not only about performance, our goal is to make it robust, rich in features and easy to use!

Full MVC applications

  • Single-Module
  • Multi-Module
  • Micro Applications
  • ORM
    • Transactions
    • Behaviors
    • Relations
    • PHQL
    • Events
    • Validations
    • Hydration
    • Logging
    • Profiling
    • Sharding
  • ODM for Mongo
  • Template Engine (Volt)
  • DI/IOC
  • Events Management
  • Encryption
  • HTTP Request / Response / Cookies
  • Escaping / Filtering
  • Forms Builder / Validation
  • Flash Messages
  • Cache
  • Pagination
  • Annotations
  • Security
  • Translations
  • Assets Management
  • Universal Auto-Loader
  • Logging
  • CLI

http://phalconphp.com/

Recess

You should enjoy PHP development. That’s why Recess exists. Recess is a RESTful PHP framework designed to give you a delightful development experience.

  • Tools included for every developer
  • Declarative PHP with annotations
  • Stays out of your way, not in it
  • Loosely coupled Model-View-Controller
  • Create RESTful APIs with Ease
  • D.R.Y. in philosophy & practice
  • Caching-oriented architecture
  • Open source under MIT license

http://www.recessframework.org

Restler

A RESTful API server framework that is written in PHP that aids your mobile / web / desktop applications. A framework, but with a difference – Restler is all here to bend and mend to your needs. Turn your classes and its methods into an easily usable and better Web citizen with Restler.

  • Writing Server is made easy and light with just 3 PHP files
  • Simplicity through writing object oriented PHP like
  • Public methods are automatically mapped to a URL
  • Customization options and plugin architecture
  • Supporting for different formats like json, xml, yaml, amf, plist and custom formats
  • Support for different authentication schemes allowing to add your own auth plugins

http://luracast.com/products/restler

Slim

Slim is a lightweight PHP micro framework for simple yet powerful web applications and APIs.

  • Powerful router
    • Standard and custom HTTP methods
    • Route parameters with wildcards and conditions
    • Route redirect, halt, and pass
    • Route middleware
  • Template rendering with custom views
  • Flash messages
  • Secure cookies with AES-256 encryption
  • HTTP caching
  • Logging with custom log writers
  • Error handling and debugging
  • Middleware and hook architecture
  • Simple configuration

http://www.slimframework.com

Symfony2: FOSRestBundle

This bundle provides various tools to rapidly develop RESTful API’s & applications with Symfony2. Features include:

  • A View layer to enable output and format agnostic Controllers
  • A custom route loader to generate url’s following REST conventions
  • Accept header format negotiation including handling for custom mime types
  • RESTful decoding of HTTP request body and Accept headers
  • Exception controller for sending appropriate HTTP status codes

https://github.com/FriendsOfSymfony/FOSRestBundle

Symfony2: Silex

Silex is a PHP microframework for PHP 5.3. It is built on the shoulders of Symfony2 and Pimple and also inspired by sinatra.

A microframework provides the guts for building simple single-file apps. Silex aims to be:

  • Concise: Silex exposes an intuitive and concise API that is fun to use.
  • Extensible: Silex has an extension system based around the Pimple micro service-container that makes it even easier to tie in third party libraries.
  • Testable: Silex uses Symfony2’s HttpKernel which abstracts request and response making it very easy to test apps & the framework itself.
  • Respects the HTTP specification and encourages its proper use.

http://silex.sensiolabs.org

Tonic

A resource focused PHP RESTful API library where everything useful is a resource located by URLs.

  • URI annotations
  • Content negotiation
  • Method conditions
  • Mount points

http://peej.github.io/tonic

Wave Framework

A compact PHP micro-framework built loosely on model-view-control (MVC) architecture and factory method design pattern. It is made for web services, websites, info-systems and is built around a native API architecture, caching and smart image and resource management. Wave is a framework that does not include optional libraries with a very small footprint, lightweight and speed in mind.

Wave comes by default with a view controller and a gateway intended for website functionality with clean URLs that also incorporates a front-end JavaScript controller.

  • Modern API-centric framework for PHP versions 5.3 and above
  • Secure API requests with hash validation, token and key-based authentication
  • Dynamically loaded Hierarchical MVC objects through Factory pattern
  • API returns XML, CSV, JSON, HTML, native PHP and other data formats
  • Compressed data output with Deflate and Gzip
  • Input and output data is fully UTF-8
  • PDO-specific database controller for general-use database connections
  • Index gateway and Handlers for all types of HTTP requests
  • Caching system with tagging support for all types of dynamic and static requests
  • View and URL Controllers that support multiple languages and clean URL’s
  • Users and permissions control
  • jQuery JavaScript framework supported
  • On-demand dynamic image resizer and editor
  • On-demand resource compression, unifying and minifying
  • Automatic sitemap.xml and robots.txt generation
  • Automatically generated API documentation
  • API wrapper classes that make browser and server to server communication easy
  • 256bit Rijndael encrypted data transmission
  • API Observers for creating event-specific listeners
  • Installation-specific MVC class and resource overrides
  • Custom on-demand session handling
  • Request limiter that can block HTTP requests under certain conditions
  • Request logger that can be used for detailed performance grading of HTTP requests
  • Debugging, backup, update and filesystem maintenance tools
  • Compatibility script that tests support for server setup
  • Supports Apache and Nginx servers in Linux and Windows environments
  • Test Suite for API Testing
  • Filesystem caching, database cache, APC and Memcache supported
  • 100+ pages of detailed documentation and tutorials
  • Licensed under GNU Lesser General Public License Version 3

http://www.waveframework.com

Yii

Yii is a high-performance PHP framework best for developing Web 2.0 applications. It comes with rich features: MVC, DAO/ActiveRecord, I18N/L10N, caching, authentication and role-based access control, scaffolding, testing, etc. It can reduce your development time significantly.

http://www.yiiframework.com/

Zend: Zend_Rest_Server

Zend Framework 2 is an open source framework for developing web applications and services using PHP 5.3+. Zend Framework 2 uses 100% object-oriented code and utilises most of the new features of PHP 5.3, namely namespaces, late static binding, lambda functions and closures…

http://framework.zend.com

Other PHP REST API Frameworks

If you wish to add a missing and actively developed framework or make any suggestions on how to improve this page please feel free to leave a comment.