Overview Seagull 2.0
Table of Contents
- code location: http://github.com/seagullsystems/sgl2
- current version: 2.0.0
- no compatibility with 0.6-bugfix branch
- 0.6-bugfix will continue to be maintained separately
Related
- 2_0/ApiDocs API Docs
- 2_0/Event_Handling SGL2 Event Handling
- 2_0/Overview Overview Seagull 2.0
- 2_0/Overview/Trunk_Changes
- 2_0/Routing static login.route
- 2_0/UnitTests Unit Tests
What's New?
- clarified distinction between tasks and filters
- managers have been renamed to controllers
- master templates have been renamed to layouts
- actions changed from _cmd_actionName() to _doAction()
- exclusive use of exceptions, try/catch, no PEAR errors
- all php errors captured and thrown as exceptions
- much easier to extend and override all classes in the framework
- cleaner request handling
- distinction between tainted/clean data
- Zend_Filter_Input used for powerful filtering and validation of data
- class member visibility identifiers (private/protected/public) enforced
- type hinting used throughout
- we've moved to PHPunit for testing
- routing now standard, Horde_Routes used and encapsulated in SGL2_Router
- CSS/Javscript - Yaml and jQuery are the currently preferred frameworks but of course you can use whatever you want
- PHP autoload includes all files automatically, no need to require files if you follow PEAR naming conventions
- use-at-will architecture, only named classes are loaded
- environment (autoload, include paths) initialised by just including SGL2.php, only 2 files loaded!
- PEAR no longer bundled
- Coding Standards enhancements
- includes must go at top of files
- no more conditional includes
- reducing number of files is not a top concern as opcode cache usage is presumed
- single installation of Seagull framework for all your projects
What's Planned
- event hooks and plugin architecture
- PEAR packaging and hosting of all components, ie "pear upgrade seagull/core" instead of "svn up"
- continuous integration environment with PHPunit and friends
- 100% code coverage (well as close as possible)
What you Need
- the most recent versions of PEAR and Zend framework must be in your PHP include path (set in php.ini)
- the most recent version of Horde Routes
$ sudo pear channel-discover pear.horde.org $ sudo pear install horde/routes
- a commandline terminal :-)
New Conventions
Resources stored in Registry
All framework resources are now stored in a registry (SGL_Registry), get them from the registry rather than using singletons
$req = SGL_Registry2::get('request');
$cache = SGL_Registry2::get('cache');
$db = SGL_Registry2::get('db');
// ... etc
Input/Output objects replaced by Request/Response
The parameters to all controller action methods were SGL_Registry and SGL_Output, respectively, in 0.6-bugfix, referred to by the variables $input and $output. The same variables are used in >= 2.0 but now refer to the SGL2_Request and SGL2_Response objects, and are only used for storing request and response data and not any internal objects.
Core Project Values
- less is more
- avoiding code bloat: all additional features/enhancements are installed on a plugin basis, core is kept clean and minimal
- no wheel reinvention tolerated: usage of existing high quality libs that conform with PEAR/PHP coding standards
- doing things the 'PHP way' preferred rather than over-engineering code
- performance is key: Seagull continues position itself as a problem solver for high traffic environments
- no dumbing down for PHP newbs, not worth the tradeoff in code bloat
