|
| 1 | +# ZF2 Tutorial in Cougar |
| 2 | +---- |
| 3 | + |
| 4 | +This project demonstrates how to implement the Zend Framework 2 Album tutorial |
| 5 | +using the [Cougar Framework](https://github.com/alfmel/cougar). Please note that |
| 6 | +the Cougar framework is only for building REST-based APIs. That means this |
| 7 | +implementation does not have a real User Infterface (UI). (In the future we hope |
| 8 | +to create an interface in Angular.js to make a full comparison.) |
| 9 | + |
| 10 | +The purpose of the comparison is not to say that one framework is better than |
| 11 | +another; it is to show how the Cougar Framework can help you build REST-based |
| 12 | +APIs faster. The Cougar Framework is optimized to solve the REST API problem and |
| 13 | +pales in comparison to the Zend Framework in terms of features and flexibility. |
| 14 | + |
| 15 | +If you are wondering if the Cougar Framework is worth using, look at the code. |
| 16 | +We believe the APIs written with Cougar are simpler to write and manage. They |
| 17 | +also requires less lines of code. |
| 18 | + |
| 19 | +To write the API backend for the ZF2 tutorial in Cougar, it takes 5 files and |
| 20 | +about 150 lines of code (101 lines in PHP and about 40 in required annotations |
| 21 | +in the comments). |
| 22 | + |
| 23 | +``` |
| 24 | +$ cloc lib web |
| 25 | + 8 text files. |
| 26 | + 8 unique files. |
| 27 | + 2 files ignored. |
| 28 | +
|
| 29 | +http://cloc.sourceforge.net v 1.60 T=0.03 s (198.8 files/s, 9972.2 lines/s) |
| 30 | +------------------------------------------------------------------------------- |
| 31 | +Language files blank comment code |
| 32 | +------------------------------------------------------------------------------- |
| 33 | +PHP 5 35 160 101 |
| 34 | +HTML 1 0 0 5 |
| 35 | +------------------------------------------------------------------------------- |
| 36 | +SUM: 6 35 160 106 |
| 37 | +------------------------------------------------------------------------------- |
| 38 | +``` |
| 39 | + |
| 40 | +Looking at only the backend for the ZF2 implementation, it takes 13 files and |
| 41 | +378 lines of code: |
| 42 | + |
| 43 | +``` |
| 44 | +$ cloc config init_autoloader.php module/Album/{*.php,config,src} |
| 45 | + 13 text files. |
| 46 | + 13 unique files. |
| 47 | + 3 files ignored. |
| 48 | +
|
| 49 | +http://cloc.sourceforge.net v 1.60 T=0.04 s (256.5 files/s, 12004.6 lines/s) |
| 50 | +------------------------------------------------------------------------------- |
| 51 | +Language files blank comment code |
| 52 | +------------------------------------------------------------------------------- |
| 53 | +PHP 10 62 28 378 |
| 54 | +------------------------------------------------------------------------------- |
| 55 | +SUM: 10 62 28 378 |
| 56 | +------------------------------------------------------------------------------- |
| 57 | +``` |
| 58 | + |
| 59 | +Lines of code is only one measure of productivity. So look at the code, check |
| 60 | +out the [Cougar Tutorial](https://github.com/alfmel/cougar_tutorial) and see if |
| 61 | +the Cougar Framework can help you be more productive. |
0 commit comments