Introducing The CocoFramework PHP
Octubre 30, 2012 Deixa un comentari
Last entry I wrote had been several months ago and had no time to write more.
Today I’m glad to announce my big project CocoFramework, that I’ve been developing for more than three years and that started as a solution to the problem of developing a website.
You can check the code at https://github.com/andreums/CocoFramework-PHP
What is the CocoFramework?
Coco is my PHP Framework project, the result of years working hard and learning to code better and also learning webpage and webservices scalability.
Coco is a full lightweight PHP framework that provides the following components:
- It’s free OpenSource and its PHP >=5.3 compatible
- Very customizable, easy and handly URL routing system
- HMVC (Hierarchical Model View Controller) design pattern to implement bussiness logic and application logic.
- Front Controller implementation to serve and dispatch the requests
- Authentication with HTTP_AUTHENTICATION, Database and .htaccess Role-Based authentication support.
- Supports a large sets of RDBMS systems (via PDO driver) and now will suport MongoDB NoSQL database.
- ActiveRecord implementation for making easy to deal with business objects
- Easy to implement RESTful webservices, even to create an XML or JSON based replies or any MIME type replies (can serve images, PDFs o wherever you need to serve in your business). Also helps to
- Cache interface to help caching and retreiving data from 5 different cache backends.
- Fast results and good performance (arround 25ms ~ 180 Requests/Second by request using a dual core AMD 64 Bit CPU and NGINX), the best performance is with a i7 wich show up to 700 Requests/Second using Nginx and a 500 concurrency level (tested with Apache Benchmark).
- Some APIs (Google, Yelp, Twitter … ) incoroporated to start integrating them in minutes.
- 32+ Framework Components and growing
- Cron tasks supported
- Flexible configuration files and routing files based on fast PHP array parsing.
- Extremely easy to localize your website in multiple languages.
- Very flexible views and layouts system wichs allows developer to develop the application with extremely coding reuse and helps the developers to keep common functionalities and views in one place and use everyplace is required.
- SOAP services supported (now deprecated, but will return if anyone wants to use them).
- More than 20 Software Design Patterns applied into the code.
- OpenSource BSD-like license.
Why the name of CocoFramework?
Choosing a name is not an easy task for me, so I’ve been thinking in a way I can make a name wich had to be easy to remember and pronounce and also internationally speaking has the same meaning.
But I’ve doesn’t want to name it Coco because of Cocos, I want to name it Coco because our cat whose name is Coco and its the curious animal in the earth I love cats and I love my girlfriends cat, I’m a cat-maniac, so I’ve choose to name this project Coco because of my girlfriends cat and having a name that isn’t already registered.
Some CocoFramework history
It was the second quarter of 2006 when I was studying computer science engineering at Universitat Jaume I in Castelló de la Plana (Spain) when in the students association we needed a webpage to make and manage the information and activities for the “Welcome Week ” for new students that the university makes every year in the month of October.
I’ve started coding PHP that I learned in a crash course of 10 hours from my FLOSS group at that university and begin coding seriously in PHP and HTML, but soon arrived to a point where my code was hard to debug and not easy to find the errors of a beginner who was starting coding its firsts own programs and websites.
But wasn’t until july 2008 when I’ve already left Universitat Jaume I and moved to Universitat Politècnica de València (nearest to my home) and collaborating with that students organitzation I redeveloped the 2006 website using my new knowledges of coding and design patterns that I learned at València. This point is where I begin coding the very first version of CocoFramework. That version started using MVC (Model View Controller) and some design patterns as the Singleton or the Front Controller but started without a missing piece (in that moment) that has powered the framework with extensible and very customizable URLs, that piece is called the “Router”.
After October 2008 I’ve started to think in rewrite my code with the help of my university professors who where teaching me Software Engineering, Software Design Patterns and Extreme Programming. They’ve began helping me to develop the start of the CocoFramework version of 2009 and 2010. They’ve encouraged me to keep writing code and develop it for the final degree project, a project whose every student has to develop for obtaining the degree.
After three full rewrites of the framework in 2009 I’ve began to put more and more time into the framework, while I was adding a database layer, making the domain objects using the Active Record design pattern, separating the MVC controllers and models and grouping them into modules and also writen the plugin interface. Later in 2010 when learned webservices I’ve began to incorporate some RESTful and SOAP helpers to make the actions of the framework be working as webservices, then starting coding the Authentication layer and refactoring everyday the classes of my framework to achieve a better result and perfomance. But wasn’t until 2010 that I’ve was writing the final degree memory when the CocoFramework suffered two more full rewritings. One was for migrating XML file routing to a PHP arrays based description routing system and the other is because I was worried about the poor performance of serving a webpage in near 200ms.
During the first two quarters of 2011 I was rewriting and refactoring some components and going happier everyday because I was winning in performance and speed, that in that moment was arround 70ms to do a simple request. Finally in July 2011 I’ve finished writing the Final Degree memory (that is 315 pages length) and stopped working in the framework for many months.
Then while triying to start working as a freelance (unsatisfactorily due to clients that won’t have payed me yet) I used the CocoFramework to make the client website (a real estate social network and services page), and so rewriting more and more some of the components to adjust them to the performance I’ve need to achive in that work. After six months working hard for that client, they’ve breaked the working relationship and I lost some money, and working time (I’ve been paid half the project during the first week working with them, so losing only the half of the project), and also losing motivation to continue working.
After three months of rethinking, reconsidering and with my friends encouraging me to start again and begin thinking of an startup I’ve started working again in the CocoFramework and after some code cleaning I’ve published it on Github.
And this was a week ago, I’ve been working since there to keep it going and better.
Contributing to CocoFramework PHP
If you want to contribute with the project, please contact me at andresmartinezsoto NOSPAM gmail.com or at @andreums twitter account.
The project is open for everyone who wants to contribute and make it better.
Anyways, if you have any doubt I’ll be glad to reply and help you.
You can check the code at https://github.com/andreums/CocoFramework-PHP
Or review my CocoFramework Old version code at https://github.com/andreums/framework1.5
Thanks for following me! Thanks for reading me!