Category: News

Around the Recess PHP Community

Posted by Kris | Comments ( 0 ) | Filed in: Community, News | | | | |

Just wanted to call out a couple of news items that have been bubbling up around the Recess developer community over the past week or so.

  • zdk put together a plugin for Smarty Views that is compatible with Recess 0.20. Download zdk's Recess Smarty Plugin here and check out the README for instructions in smarty/README.txt. He's also put together a simple Smarty / Recess demo app. Thanks zdk!
  • Improvements to the database stack were brought into Recess Edge on Github thanks to commits from KevBurnsJr's groupBy and midnightmonster's exists.
  • Preview scripts for the Recess Sandbox, a virtual Ubuntu development environment preconfigured with all the best open-source tools to do first class PHP software engineering are now available on Github. Setup instructions can be found on the Recess PHP Wiki (that just came online this past week and needs some help!). Expect some full-blown articles on Sandbox soon, but if you can't wait to get your hands dirty feel free to play. The Recess Sandbox setup comes loaded with:
    • Server Software
      • Apache 2.2
      • PHP 5.3 w/ a Lot of Extensions
      • MySQL
    • PHP IDE
      • Eclipse PDT 2.1
      • Integrated Debugging
      • Syntax auto-completion with Recess
    • Interactive Debugging
      • XDebug Installed and Configured
      • Ready to hook-up IDE and XDebug
    • Profiling
      • Profile any script with an additional query string
      • Visualize and inspect call graphs with KCacheGrind
    • Unit Testing
      • PHPUnit 3.4 setup
      • Run Test Coverage reports
  • Work on Recess 5.3, a branch of Recess that leverages many of PHP 5.3's new capabilities for an even more enjoyable PHP development experience, has begun in earnest. More news on this will start trickling in as our series on Functional PHP continues. If you're interested in the new functional PHP features be sure to check out the first two installments: anonymous functions, closures, and lambdas in PHP 5.3 and understanding and implementing map and reduce in PHP.

Exciting times in the land of Recess and PHP. What will this week have in store? Stay tuned to via RSS.

Screencast: Recess with Multiple Sites

Posted by Kris | Comments ( 0 ) | Filed in: News | | | | |

Kevin Burns put together a great screencast demonstrating how to work with multiple sites using one copy of Recess. Check it...

Screencast: Multiple Sites with Recess

Kevin Burns is a web developer from Menlo Park, CA. He has been doing web design and development for 6 years and is available for work in the SF Bay Area. http://kevburnsjr.com

New Features on Recess Edge

Posted by Kris | Comments ( 0 ) | Filed in: News, REST | | | | |

We're approaching the 0.2 release quickly. It represents the biggest leap in functionality for the framework yet. We've just pushed two major, related features to Recess Edge on Github: a new view selection process and content-negotiation. For folks who like to try development bits, when checking out Edge, here are some pointers on what to expect with the most recent commits:

New View Selection System based on Requested Format

The new native view system looks for an application's view template by matching a format to a file-extension. So, for example, if a visitor requests '/foo.xml' and your controller returns a view-name of 'foo', Recess now looks for the view template foo.xml.php - the same goes with json, rss, pdf, etc. For the default html format there is no additional extension, it's still just foo.php.

What about automatic JSON? It is no longer turned on by default (though, if you are using existing code, it should still work in version 0.20 but is now considered deprecated and will not be supported in 0.30). Recess has a new, more advanced mechanism for selecting views. Multiple views can be registered with a controller with the new !RespondsWith annotation, it looks like this:

/**
  * !RespondsWith Layouts, Json
  * !Prefix my/
  */
class MyController extends Controller {
   function foo() { }
}

The !Prefix annotation will be discussed shortly. Layouts and Json are both views with class names LayoutsView, JsonView respectively. These form the prioritized list which Recess will use to find a view. Suppose 'my/foo.json' is requested by the client. In this case LayoutsView will be asked first 'can you render this response?', if the view template 'my/foo.json.php' exists then answer is yes and it will render and we're done. If that file does not exist, though, then the new JsonView will be asked 'can you render this response?' and it can always render  a json request so it will. If you *always* wanted to use automatic-json for json requests then you could simply reverse the order: Json, Native. This avoids the cost of checking the file system for a json template file.

A list of the supported formats is provided in the following section.

More RESTful Goodness with Accept-based PHP Content-Negotiation

Recess now has support for parsing the HTTP Accept header (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) for content-negotiation! This means for folks using RIAs and smart-clients you can interact with your Recess applications truer to the way HTTP intends. Instead of appending a format like '.json' to a URL your clients can now use 'Accept: application/json'. Here are a list of supported mime-types and the formats they map to:

html = text/html, application/xhtml+xml
xml = application/xml, text/xml, application/x-xml
json = application/json, text/x-json application/jsonrequest
js = text/javascript, application/javascript, application/x-javascript
css = text/css 
rss = application/rss+xml 
yaml = application/x-yaml, text/yaml 
atom = application/atom+xml 
pdf = application/pdf
text = text/plain
png = image/png 
jpg = image/jpeg, image/pjpeg 
gif = image/gif
form = multipart/form-data
url-form = application/x-www-form-urlencoded
csv = text/csv

In the rare case you need to accept a MIME-types not listed above you can add it to the mix with the following: MimeTypes::register('foo', 'application/foo'); The second argument can also be an array to support multiple mime types referring to the same format.

New Controller Annotation: !Prefix

It has become a common case in Recess development for the view and route prefix to be the same. A new annotation allows you to specify both with a single annotation:

!Prefix foo/     (now relative routes and views are prefixed with foo/)
!Prefix Routes: /, Views: home/      (allows you to set them individually)

Note: Deprecated Controller Annotations: !View, !RoutesPrefix

The !View annotation is still supported in 0.2 but is deprecated and will be unsupported in v0.3 - It is replaced by !RespondsWith

The !RoutesPrefix annotation is still supported in 0.2 but is deprecated and replaced by !Prefix

Warning: Not-yet-backwards-compatible: PUTing / POSTing JSON

Work is still being done on data that is PUT/POSTed to the server with alternate MIME-types. For folks who depend on POSTing/PUTing JSON please hold off on pulling the latest bits from Edge. This is coming soon and will allow other content-type parsers (XML, for example) to be plugged-in. We're also decoupling the format of input from output, so, for example, you could post JSON and ask for HTML back.

We're getting really close to the 0.2 release and we need your help in testing the bits, reporting and submitting patches for bugs, and contributing to the documentation. Can't wait to get 0.2 out the door!

 

Upcoming Developments in the Recess PHP Framework

Posted by Kris | Comments ( 0 ) | Filed in: News | | | | |

A number of balls are currently in the air and in motion with respect to development on the Recess Framework. I wanted to take some time to provide a 'State of Recess Developments' update.

View Layouts & Templating Layer

Joshua Paine has been leading development on a thin templating layer sitting above native PHP. The system enables master layouts which have areas that will be filled with content. These areas are called 'slots'. View templates which 'extend' a master layout can fill slots with 'blocks'. Blocks are chunks of HTML output. Master layouts can be extended by intermediate layouts in a nestable fashion. Kev burns created this diagram of the system which helps visualize how these concepts fit together.

Along with layouts will come a view helpers system and fundamental helper classes. Helpers provide simple methods to output common chunks of HTML.

This exciting templating system will become the defacto View layer for Recess.

Plug-in Model

The inspiration for a standard Recess plug-in model bubbled up from three prominent community members (Kev Burns, Jamie Rumbelow, & Luiz Zaiats) independently. Right now we are in the spec'ing process and exploring the design space for plug-ins. The current train of thought is that plug-ins will offer developers the ability to drop entire components of functionality into a Recess application. Components can range from an authentication system to specific special abilities on Models. There are some key high-level design questions which deserve deliberation:

  1.  What does it mean for a plug-in to have controllers and views?
  2.  Can apps interact / override a plug-ins controllers and views? How?
  3.  Should plug-ins be shared across apps? Or are they contained within a single app?
  4.  For plug-ins with models, how should they specify/install default data? (i.e. an address plug-in may need to have a country table pre-filled)
  5.  What does the ideal plug-in installation process look like?
  6.  What does the spectrum of possible plug-ins look like? The smallest example of a plug-in? The average plug-in? The most expansive plug-in?


Let's do some thinking on these questions around while we continue prototyping.

Extensibility Points

In anticipation of the upcoming plug-in model Kris has been rewiring the fundamentals of Recess' internals. A new, core class has been introduced: FrameworkObject. The purpose of FrameworkObject is two-fold:

  1. to standardize the process of expanding annotations on a class, and
  2. to introduce a new type of extensibility point called 'Wrappable Methods'.

Central classes like Model, View, and Controller now extend from FrameworkObject. Important methods in Model, like insert() and update(), and important methods in Controller, like serve() and init() are now wrappable. Wrappable methods can be wrapped by classes implementing the IWrapper interface. The IWrapper interface has two methods, before() and after(), which are called before and after method execution. The before method has an opportunity to manipulate arguments being passed in, while the after method can post-process the response. With pre-existing attachable methods, a standard annotation expansion process, and wrappable methods Recess should be beautifully extensible.

Model Validations

Making use of the new wrappable methods infrastructure is a model validation system. Validations will typically be specified as annotations on the fields of a model. More complicated validation logic will be specified in a validate method. Validations will be structured as an internal plug-in that a standalone model is unaware of. This is in line with one of Recess' core philosophies which is to maintain a light weight core which can be extended or replaced. The big open question with validations is which are the most important types of validators to bundle and support?

Conclusion

Some very exciting new features and capabilities are on the books to be rolled into a Recess release in upcoming weeks. Stay tuned as detailed tutorials are posted to demonstrate how you can use these new developments in your Recess apps for a faster, more enjoyable programming experience! Huge thanks to the developers in the community making this next big step for Recess possible!

Trimming Things Up in v0.11.1 and PHPUnit

Posted by Kris Jordan | Comments ( 2 ) | Filed in: News, Release | | | | |

A new version of the Recess PHP Framework has been pushed up to Github, tagged, and is ready for download (zip or tarball)!

There are a number of bug fixes included in this release. Some have been talked about in the previous post. The rest are centered primarily around database stability and improved MySQL support. Thanks to all of you who submitted bugs to Lighthouse or suggestions on the discussion board.

Changes to v0.11.1 that are not bug-fixes are the removal of 3rd party packages SimpleUnit and Smarty and shifting the supported unit testing framework from SimpleTest to PHPUnit. Though SimpleTest served us well for initial development purposes it's just not as robust or well supported as PHPUnit is. Moving the unit tests from SimpleTest to PHPUnit made for a fun, all-night project and led to a better testing suite. Now all database unit tests are executed on both MySQL and Sqlite without any manual switching. This allowed us to remove SimpleTest from the package and reduces Recess' footprint. Instructions for getting PHPUnit tests running

The other big 3rd party package to get moved outside of the source tree is Smarty. Smarty support can now be achieved through an add-on download (zip or tarball). Removing these two 3rd-party packages has trimmed the size of Recess significantly: the v0.10 tarball was 490kb, v0.11.1 is 67kb. Though Smarty users now have an extra step and folks interested in running unit tests will need PHPUnit, the experience for average users should improve with a smaller footprint and less loose files that go unused. At some point we may move the unit tests out of the main distributable and into a "Recess Hackers" distributable, but for now they're bundled with the code.

Running the Recess Unit Tests with PHPUnit

In order to run the unit tests for Recess take the following steps:

  1. Install PEAR – Typically this is done by executing the go-pear script in your PHP installation directory.
  2. Install PHPUnit (Instructions)
    1. First add the PHPUnit channel to PEAR: pear channel-discover pear.phpunit.de
    2. Next install PHPUnit with pear install phpunit/PHPUnit
  3. Setup MySQL & DSN for Database Tests
    1. The default MySQL test DSN is localhost,dbname=recess, user=recess, password=recess
    2. To use settings other than default modify recess/test/recess/database/PdoDsnSettings.php
  4. At a command prompt,navigate to recess/test/
  5. Run the Unit Tests: phpunit —bootstrap bootstrap.php AllTests.php

To contribute unit tests to Recess, fork the source on Git Hub, commit your unit tests to the fork, and request a pull from Recess. Happy testing!

Recess Gets Serious Backing

Posted by Kris Jordan | Comments ( 5 ) | Filed in: News | | | | |

Big news for the Recess Framework! The future of Recess hasn’t always been certain. A little over a month ago I was faced with the decision: give up on the Recess Framework or give up on a big job opportunity. I chose the latter. I’ll save the details of why I turned down Microsoft to continue working on Recess for a future post on my personal blog. The important news is Recess has a bright and exciting future ahead.

I have joined New Media Campaigns and will be continuing to develop Recess, blogging, and leading new development projects that will push the boundaries of Recess forward!

What does this mean for Recess?

  1. Recess has a long-term sponsor and commitment to success. Part of my role at New Media Campaigns is ensuring continued progress on the Recess Framework. Instead of being a ‘nights and weekends’ project Recess is now a focus of my job. This includes fleshing out documentation, writing tutorials and screen casts, and continuing to develop the code base.
  2. Early versions of Recess will be more widely used in production applications. Already we’ve written one app in Recess for documentation which will be blogged about soon. In the next couple months I will be leading the development team transitioning New Media’s flagship Content Management System to Recess. This enables Recess to continue maturing at a steady, rapid pace.
  3. Recess is still 100% open-source under the MIT License. New Media Campaigns is an advocate of the LAMP stack and their sponsorship of Recess is a great way to give back to the PHP community. The Recess Source is proudly hosted on GitHub and will continue to be!

Get excited folks: this fledgling PHP framework just grew some legs!

In other news we have opened up the Recess Preview Program and download so that registration is not required. In order to post to the discussion board, however, registration is required. As the documentation efforts ramp up here please defer to the discussion board with all questions. Have a great weekend!