What Is CakePHP?
The CakePHP framework offers robust and free base for anyone looking to build websites and blogs from the ground up.
Model View Controller (MVC) Architecture
The framework follows model view controller (MVC) architecture, which makes it easy to customize.
CakePHP follows a "convention over configuration" philosophy, like Ruby on Rails.
This speeds up developing a CakePHP application since there are few configuration files to set up.
How Is It Used?
The framework provides a basic organizational structure designed to keep your application consistent and logical, thus streamlining the development process.
CakePHP also supports application scaffolding, templating, flexible access control list (ACL) and a range of other features. The principal packages include the following:
|Core||Class loading, plugin management, configuration|
|Model||Object-relational mapper, model behavior and validation, access control|
|Controller||Organization of business logic, component registry, error handling|
|View||Manages Helpers, which implement view part of MVC|
|Log||Registers and provides base class for all loggers|
Some Experience Needed
While it is supposed to make development easier, basic PHP knowledge is required and experience in object-oriented programming also helps.
Using a Framework
Frameworks are a popular way to build PHP applications. They save coding effort and reduce bugs by providing tested code for common needs. Several frameworks compete for developers' interest, including CakePHP, Symfony, CodeIgniter, and Laravel.
CakePHP's greatest strength is making it easy to get from the initial requirements to a working application. Applications built with it generally require less code than applications with other frameworks.
On the negative side, CakePHP has a reputation for creating applications that are larger and run slower than other frameworks.
Ease of use has a price. Developers who favor the convention-first approach will like CakePHP, though Laravel is an alternative with a similar philosophy.
CakePHP Server Requirements
In order to create a CakePHP site you will need to install the framework, create and configure a database and of course proceed to create a workable application logic.
Your server setup will need to look something like this:
- HTTP server (such as Apache)
- PHP 5.6.0 or greater
- mbstring PHP extension
- intl PHP extension
- mcrypt PHP extension
- Database server running MySQL 5.1.10 or greater
CakePHP is usually deployed on Apache, but it will work on other hypertext transfer protocol (HTTP) servers as well.
The server needs to support PHP 5.x and the current spec recommends PHP 5.6.0 or greater.
CakePHP also requires mbstring, mcrypt and intl extensions. The framework also requires a database engine, so you will need a database server running MySQL 5.1.10 or greater.
SQLite 3, PostgreSQL and Microsoft SQL Server (2008 or higher) are supported as well and there is a "wrapper" for ADOdb too.
Any server that has all the required libraries should have no trouble coping with CakePHP.
CakePHP is open source and is licensed under the Massachusetts Institute of Technology (MIT) license.
This means you can change, share, distribute and include CakePHP in other applications.
Several ways are available to learn about CakePHP and get questions answered.
- Online documentation including the CakePHP Cookbook
- CakePHP forum
- CakePHP tag on Stack Overflow
- CakePHP's Slack channel
- Paid support through Cake Development Corporation
CakePHP Hosting Types
Your level of skill will dictate the type of hosting plan you choose for CakePHP.
The more adept you are at PHP, the more you'll likely need a more expensive plan.
Since CakePHP is designed to streamline development and help novices (although PHP skills are necessary), many hosts tend to offer entry-level hosting packages tailored for CakePHP.
Free, but fairly limited, packages are also available and they may be suitable for testing, but not actual deployment.
Many entry-level CakePHP packages tend to offer 1-click setup, but they are limited on other fronts, e.g. the number of processes and connections, storage and so on.
It is usually just a matter of scaling, as you are likely to get a fully configured installation of CakePHP and expand the package according to your needs by adding more core storage, traffic, bandwidth or database storage.
Looking for quality CakePHP hosting?
At a bargain price? A2 Hosting ranked #1 in our recent speed tests. You can now save up to 50% on their developer-friendly plans. Use this special discount link to get the deal.
Professionals may be interested in dedicated MySQL packages, offering more memory and storage, including fast solid-state storage in some packages. However, many independent developers and small businesses tend to choose more affordable, shared packages.
Server Compatibility With Dedicated Hosting
CakePHP is usually deployed on Linux, Apache, PHP, and MySQL (LAMP) servers, but the framework also works on Microsoft IIS, Nginx and LightHTTPD.
In case you already have a server and see no need to get another package with preinstalled CakePHP, you can choose to install it yourself.
CakePHP uses PHP 5.3+ dependency management tool Composer as the officially supported method for installation. It's a simple process:
- Make sure PHP is updated at least to 5.6.
- Install Composer if necessary.
- Use the create-project command to create a skeletal CakePHP application.
Manual or Automatic installation?
While Composer may automate much of the process, some developers may require more control and decide to do it the old-fashioned way.
Nightly and Stable Builds
The most recent stable version of CakePHP code is readily available at CakeForge, but some developers may decide to use "nightly" versions which tend to include the latest bug fixes between stable releases.
Regardless of which download you choose, the compressed installation package should be placed on the webroot and unpacked.
Two different setup options are available — a less secure development setup that should be used in safe environments and a production setup used to deploy the finished product.
Production setup requires you to have the right to change the DocumentRoot on your server, so keep that in mind.
Advanced Setup Alternatives
There are also a number of advanced setup alternatives for power users, allowing them to place CakePHP directories on different places on the disk.
This can be done to allow several applications access to the same CakePHP libraries, but it is also a way of getting around certain shared host restrictions.
Certain tweaks to Apache may be necessary to allow mod_rewrite functionality.
These problems usually manifest themselves on the CakePHP welcome page and if you spot missing images or CSS styles, chances are you will need to address this problem.
Luckily there is a lot of documentation that should help you identify and fix these issues.
Pros and Cons
As with most technology, CakePHP comes with upsides and downsides. It's important to take a look at these plusses and minuses from the point of view of your specific needs. Here's how I think CakePHP's features shake out.
- Quick creation of working code
- Minimal need for configuration
- Clean MVC architecture
- Active support community.
- Produces less efficient code than some frameworks.
Looking for a great deal on CakePHP hosting?
SiteGround — rated #1 by our readers — supports CakePHP and provides easy installation. Right now you can save up to 67% on SiteGround plans by using this special discount link.
My Top 3 CakePHP Hosts
If you're focusing on CakePHP, you'll want a short lists of hosts to evaluate. To give you a head start, I've picked three hosting companies that excel at CakePHP hosting.
A2 Hosting CakePHP Hosting
A2 Hosting gives full instructions for installing CakePHP manually, which all hosting accounts can do.
Customers with cPanel and Softaculous Premium can install it easily using those tools.
You can use PHP5 or PHP7, and the Turbo Server option lets you serve pages with exceptional speed.
Solid state drives, Cloudflare CDN, a 99.9% uptime guarantee, and 24/7 support add to the value offered.
HostGator CakePHP Hosting
HostGator lists CakePHP as compatible with its shared, reseller, VPS, and dedicated servers, including both Linux and Windows.
It doesn't appear to provide any assistance with installation, though.
Customers can use PHP7 on all servers except Windows shared hosting.
Support is available 24 hours a day, and shared and reseller accounts get a 99.9% uptime guarantee.
FastComet CakePHP Hosting
FastComet is a rather lesser-known host provider, but it features CakePHP on SSD cloud hosting.
Fully managed dedicated hosting with free transfer of an existing CakePHP site is an option.
All hosting plans include cPanel and Softaculous.
24/7 support by live chat and email is free with all plans, and FastComet has seven data centers around the world.
Other features in Languages and Frameworks
- .NET Framework
- Ruby on Rails
- Server Side Includes
- PHP 5
- PHP 7
CakePHP Frequently Asked Questions
- What is CakePHP?
CakePHP is a rapid-development framework for PHP that follows the model-view-controller (MVC) architecture, making maintenance of code eaiser.
- Is CakePHP easy to learn and use?
Most people find that getting started with CakePHP is simple. However, some knowledge is required. For example, PHP knowledge and experience is a must.
- What are the server requirements for CakePHP?
If you want to create a website using CakePHP, the framework must be installed on your server. You should check with your hosting company, but in general, you will need to be running an Apache server with PHP and a compatible database system.
- Is CakePHP open-source?
Yes. For this reason, you can share, distribute, and make any changes necessary to CakePHP. It is available under the Massachusetts Institute of Technology (MIT) license.
- Do all hosting companies provide the CakePHP framework?
Many hosting companies offer packages built for CakePHP use. Those that do typically have one-click setup, allowing you to get started without delay. You should ask your hosting company.
- What are the best hosting companies for CakePHP?
There are hundreds to consider. Use our hosting compare tool to narrow your choices to hosts that offer Linux, PHP, and MySQL. From there, you can see if they support CakePHP.
- How do I get started using CakePHP?
There are many guides and documentation available with CakePHP, making it easy to code your website. In particular, check out the documentation of the Official CakePHP website.
- What is the cost of development with CakePHP?
Since the framework is open-source, you don't have to pay any money to use CakePHP. The fact that it's free keeps web development costs to a minimum, especially if you are doing the work yourself.
All the settings you require to get started are included with the framework. Hosting is your only direct cost. The only other thing you need is the time to learn and use CakePHP.
- What are the biggest benefits of using CakePHP?
In addition to being open-source, it is compatible with earlier versions of PHP and the MVC architecture. Also, it is able to manage both themes and content while also making it simple to customize templates and fields.
- Does CakePHP have special configuration requirements?
Thanks to auto-detect, developers don't have to specify the URL of the site or the location of the library. They only need to worry about the database connection settings. Once these are correct, everything else takes care of itself.
- How big is the CakePHP community?
It is hard to put an exact number on the size of the community, but it is safe to assume there are tens of thousands of developers using the CakePHP framework to build websites and applications.
For those who like what the framework has to offer, but don't want to do the work on their own, there is a robust developer community to hire from.
- Can you install CakePHP on your own?
If your server does not come pre-installed with CakePHP, you may have the option of installing it on your own. Before doing so, check with your hosting company to ensure that your server has the capability of handling the framework.