agavi (2010-07-31)

49

Upload: david-zuelke

Post on 15-Jan-2015

1.358 views

Category:

Technology


1 download

DESCRIPTION

Presentation given at Japan PHP User Group meetup

TRANSCRIPT

Page 1: Agavi (2010-07-31)
Page 2: Agavi (2010-07-31)

THE AGAVI FRAMEWORK

日本 PHP ユーザ会

Page 3: Agavi (2010-07-31)

David Zülke

Page 4: Agavi (2010-07-31)

David Zuelke

Page 5: Agavi (2010-07-31)
Page 6: Agavi (2010-07-31)

http://en.wikipedia.org/wiki/File:München_Panorama.JPG

Page 7: Agavi (2010-07-31)

Founder

Page 9: Agavi (2010-07-31)

Lead Developer

Page 12: Agavi (2010-07-31)

HISTORY(Won’t Take Long)

Page 13: Agavi (2010-07-31)

< 2005

Page 14: Agavi (2010-07-31)

Sean Kerr

Page 15: Agavi (2010-07-31)

Mojavi 1, 2 & 3

Page 16: Agavi (2010-07-31)

Page 17: Agavi (2010-07-31)

2005

Page 18: Agavi (2010-07-31)

Mojavi 3 died

Page 19: Agavi (2010-07-31)

forked

Page 21: Agavi (2010-07-31)

Sean Kerr came back, eventually

Page 22: Agavi (2010-07-31)

and of course, he chose Agavi over Symfony :)

Page 23: Agavi (2010-07-31)
Page 24: Agavi (2010-07-31)

AT A GLANCEAgavi’s Key Features and Approaches

Page 25: Agavi (2010-07-31)

NO ASSUMPTIONS

• Being PHP based, it works best for websites and other HTTP-based stuff, but you can use it to write any app.

•No requirements for specific template engines, DBMSes, ORMs, client side JS libraries etc.

• Abstraction of HTTP request method verbs, output types, response implementations etc.

• Form Handling is independent of libraries or template engines.

Page 26: Agavi (2010-07-31)

REUSE CODE

• The right things are done in the right places, and the framework prevents common mistakes.

• Exposing Actions of a web application through a SOAP web service API etc. can be done in minutes.

•Want an RSS feed of your latest products? It’s just a new output type away.

•Want to return JSON for Ajax features? Have it done when a JS framework sends the right request headers!

Page 27: Agavi (2010-07-31)

ENVIRONMENTS AND CONTEXTS

• An Environment is bootstrapped for every box or developer. Could be “production”, or “dev-joecool” etc.

• A Context represents a way of accessing the application, like “web”, “soap” or “console”.

• Any configuration can be specific to one or more Environment(s) and/or Context(s).→ no more copying and overwriting of DB configs!

Page 28: Agavi (2010-07-31)

MODULES, ACTIONS, VIEWS ETC

• An Application has a number of Modules.

• Each Module has Actions with corresponding Views and Templates, as well as various configuration files that control caching, validation and so on.

• Actions, which can also be nested into folders, contain application logic, make calls to Models, and have one or more Views (“Error”, “Success”, “Input” etc.)

• Views handle presentation, usually using Templates.

Page 29: Agavi (2010-07-31)

EXECUTION CONTAINERS

• Every Action execution happens in an isolated Container.

• Every container has it’s own request data, response, filters etc.

• A normal execution does not affect the “outside world”.

• Internal forwarding can be done by returning a new Container from a View.

Page 30: Agavi (2010-07-31)

FILTERS

• Global Filters or per-Action/Container filters.

•Wrap the execution, and call the next Filter in the chain - like an Onion or a Russian Nested Doll.

• Features like Security or Form Handling are implemented using Filters inside Agavi.

• Flow can be redirected internally, response info can be modified etc; numerous possibilities.

Page 31: Agavi (2010-07-31)

LAYERS AND LAYOUTS

• A View can leave instructions on Templates to render; these are called Layers.

• Each Layer has access to the output of the previous Layers, and can define Slots - Containers with Actions that are run before rendering, returning the content.

• Layer and Slot definitions can be made in a configuration file; the result is a Layout.

• All this can be done programmatically, as well.

Page 32: Agavi (2010-07-31)

ROUTING

• Used for matching URLs, SOAP method names.

• Every route can have children.

• Callbacks can control and modify behavior on matching or when generating URLs.

• Routes can also set Output Types, force continuing of execution even though they matched, and much more.

• Also very nice for refactoring existing applications.

Page 33: Agavi (2010-07-31)

FORM HANDLING

• Form Population Filter makes form handling a breeze.

• Can pre-populate forms using given values.

• Re-populates a form when an error occurred.

• Highlights erroneous fields and labels.

• Can insert error messages into the document.

• All without a single line of code in templates.

Page 34: Agavi (2010-07-31)

CACHING

• Cache the entire execution of a request, or just parts.

• Action-based, so a Slot that runs can be cached, too.

•Output can be cached on a per-layer basis, so that the outer master template always runs even when cached.

• Also caches cookies (with correct lifetime!), HTTP headers that were set etc.

Page 35: Agavi (2010-07-31)

VALIDATION

• Validates not only request parameters, but also Files, Cookies and HTTP Headers.

•Default settings mean you only have access to data you validated.

•Drastically reduces the possibility of programmer errors.

• Validators can have dependencies (“only validate email if checkbox is on”), different severities, handle arrays, normalize values (e.g. make Unix TS from date value).

Page 36: Agavi (2010-07-31)

CONFIGURATION

• Configuration files are XML based.

• Leverages the entire XML ecosystem, for instance:

• XML Schema, RELAX NG and Schematron validation

• XSLT for transformations and backward compatibility

• XIncludes for re-use of common settings

• Essential for structured code without workarounds and hacks.

Page 37: Agavi (2010-07-31)

INTERNATIONALIZATION

• Bundles the Unicode CLDR database with information about all locales of this world.

• Functions for translating text, formatting and parsing dates, numbers and currency values, calendar and timezone operations, locale information (e.g. list of all countries in Japanese language etc.)

• Parts of the functionality are ports of ICU, IBM’s Java/C library for globalization.

Page 38: Agavi (2010-07-31)

I’m terribly sorry you had to endure 12 slidesfull of bullet points.

Page 39: Agavi (2010-07-31)

HANDS-ONLet’s Play With an Agavi Application

Page 40: Agavi (2010-07-31)

SOFT SKILLSThe Little German Things

Page 41: Agavi (2010-07-31)

TICKETS, FEATURES, ROADMAP

• Every change has a ticket

•Milestones are public

• Impeccable Changelogs and detailed Release Notes

• Standards process for big changes, modeled after Python PEPs

•Only one vulnerability in the history of the project; dealt with properly using MITRE’s CVE list and detailed announcements.Read http://trac.agavi.org/ticket/1019 if you’re interested.

Page 42: Agavi (2010-07-31)

1.0.2  (January  27,  2010)-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐

CHG:  Update  timezone  database  to  2010b  (#1219)  (David)CHG:  Update  ISO  Schematron  to  version  2010-­‐01-­‐25  (#1217)  (David)

FIX:  Build  system  is  incompatible  with  Phing  2.4.0  (#1216)  (David)FIX:  Form  Population  Filter  doesn't  filter  out  empty  error  messages  (#1214)  (David)

1.0.2  RC4  (January  19,  2010)-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐

ADD:  Support  for  HTML  5  forms  (#1213)  (David)ADD:  Support  for  Doctrine  1.2  (#1210)  (David)ADD:  Include  error  type  and  code  when  reporting  libxml  errors  (#1202)  (David)

CHG:  Update  timezone  database  to  2009u  (#1207)  (David)CHG:  Move  error  suppression  operator  for  XML  validation  calls  to  wrapper  methods  (#1201)  (David)

FIX:  ICU  Bug  6814  (#1211)  (David)FIX:  AgaviTimeZoneDataParser  doesn't  support  "-­‐"  as  a  time  value  (#1208)  (David)FIX:  Several  method  existence  checks  don't  deal  with  visibility  (#1205)  (David)FIX:  Configuration  parameter  whitespace  handling  is  inconsistent  (#1203)  (David)FIX:  Regression:  single  Propel  init  query  is  lost  during  initialization  (#1194)  (David)FIX:  Regression:  support  for  Propel  1.3  is  broken  (#1195)  (David)

1.0.2  RC3  (December  8,  2009)-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐

ADD:  Support  for  Propel  1.4  (#1181)  (David)

CHG:  Use  printf  rather  than  echo  in  bin/agavi  (#1191)  (David)CHG:  Update  to  PHPUnit  3.4.3  (#1184)  (David)CHG:  Update  timezone  database  to  2009s  (#1188)  (David)CHG:  Make  HTTP  Content-­‐Type  response  header  charset  detection  in  AgaviFormPopulationFilter  more  robust  (#1187)  (David)

FIX:  Validation  drops  first  element  in  multi-­‐dimensional  array  exports  (#1189)  (Dominik)FIX:  AgaviToolkit::literalize  incorrectly  returns  null  for  certain  input  values  (#1190)  (David)FIX:  HTML  meta  tag  charset  detection  in  AgaviFormPopulationFilter  never  matches  strings  without  quotation  marks  (#1185)  (David)FIX:  FormPopulationFilter  raises  warning  with  old  PCRE  versions  (#1183)  (David)FIX:  AgaviWebResponse  throws  notice  if  "http_headers"  parameter  is  not  an  array  (#1186)  (David)FIX:  Duplicate  error  message  if  agavi  console  script  cannot  determine  Phing  version  (#1180)  (David)

1.0.2  RC2  (November  6,  2009)-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐

CHG:  Update  to  PHPUnit  3.4.2  (#1178)  (David)CHG:  Change  generated  timezone  files  to  have  version  info,  not  timestamp,  in  header  comments  (#1177)  (David)CHG:  Update  timezone  database  to  2009q  (#1176)  (David)

FIX:  AgaviAttributeHolder::removeAttribute()  does  not  return  values  by  reference  if  array  key  access  is  used  (#1175)  (David)FIX:  AgaviParameterHolder::removeParameter()  causes  notice  for  invalid  keys  when  calling  with  by-­‐ref  assignment  (#1174)  (David)FIX:  agavi.bat-­‐dist  lacks  double  quotes  for  PHP  and  Agavi  path  assignments  (#1172)  (David)FIX:  AgaviConfigParser::convertEncoding()  performs  case-­‐sensitive  comparison  of  encoding  (#1162)  (David)FIX:  AgaviConfigParser::convertEncoding()  produces  notice  when  throwing  exception  (#1161)  (David)FIX:  Shiny  exception  template  prepends  file  paths  with  an  underscore  (#1156)  (David)FIX:  agavi.php  erroneously  always  assumes  it  is  a  symlink  if  project.directory  is  empty  (#1155)  (Felix)

1.0.2  RC1  (September  13,  2009)-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐

ADD:  Accept  optional  argument  identifier  in  AgaviValidator::getArgument()  (#1142)  (David)ADD:  Support  for  PHPTAL  1.2  (#1141)  (David)ADD:  Allow  optional  strict  comparison  in  AgaviEqualsValidator  (#1128)  (David,  Dennis  Meckel)ADD:  Allow  optional  strict  comparison  of  elements  in  AgaviInarrayValidator  (#1107)  (David)

CHG:  Update  timezone  database  to  2009m  (#1154)  (David)CHG:  Update  old  tests  to  use  bundled  PHPUnit  (#1153)  (Felix)CHG:  Update  to  PHPUnit  3.4.0RC3  (#1152)  (Felix)CHG:  Refactor  renderers  to  perform  engine  creation  in  separate  methods  (#1139)  (David)CHG:  Improve  AgaviDatabaseConfigHandler  error  message  in  case  no  database  connections  are  configured  (#1138)  (David)CHG:  Support  PHP  namespaces  in  configuration  schemas  (#1133)  (David)CHG:  Validator  shortcut  "arraylength"  should  default  to  minimum  of  one  element  (#1123)  (David)CHG:  Backport  any  necessary  ICU  changes  and  fixes  (#858)  (Dominik)CHG:  Remove  unnecessary  use  of  create_function()  in  AgaviInarrayValidator  (#1112)  (David)CHG:  Update  ISO  Schematron  to  version  2009-­‐05-­‐18  (#1103)  (David)CHG:  Routing  callback  parameters  should  be  set  before  initialize  method  is  called  (#1105)  (David)

FIX:  AgaviValidationReportQuery::getResult()  possibly  throws  a  notices  when  used  with  byValidator  queries  (#1151)  (Dominik)FIX:  AgaviLdmlConfigHandler  does  not  compile  /ldml/numbers/symbols/minusSign  (#1149)  (David)FIX:  AgaviConfigCache::writeCacheFile()  permission  error  handling  is  broken  (#1148)  (David)FIX:  AgaviVirtualArrayPath::get()  ignores  position  argument  (#1143)  (Kirila)FIX:  agavi.sh  does  not  allow  parameters  with  spaces  (#1137)  (Felix)FIX:  AgaviNumberValidator  does  not  allow  "double"  as  type  name  (#1135)  (David)FIX:  AgaviNumberValidator  mutates  invalid  input  if  translation  is  used  for  parsing  (#1136)  (David)FIX:  XML  Schema  type  "identifier"  is  broken  (#1132)  (David)FIX:  AgaviArrayPathDefinition  is  not  included  prior  to  framework  startup  (#1127)  (David)FIX:  Numeric  keys  are  reindexed,  not  merged,  in  AgaviConfig::fromArray()  (#1126)  (David)FIX:  Numeric  keys  are  reindexed,  not  merged,  in  AgaviParameterHolder::setParameters()  (#1125)  (David)FIX:  Numeric  keys  are  reindexed,  not  merged,  in  AgaviAttributeHolder::setParameters()  (#1124)  (David)FIX:  AgaviArraylengthValidator  doesn't  work  with  files  (#1122)  (David)FIX:  AgaviValidationManager::clear()  doesn't  clear  validation  errors  (#1104)  (David)FIX:  Validation  xsd  and  doc  block  comments  have  references  to  the  removed  'affects'  parameter  (#1101)  (Dominik)FIX:  AgaviTranslationManager::_n()  and  _c()  ignore  custom  locale  independent  format  (#1099)  (Dominik)FIX:  Configuration  system  does  not  permit  identifiers  to  be  one  character  in  length  (#1098)  (Noah)FIX:  Multiple  settings  blocks  and  settings  prefixes  are  not  allowed  in  module  configs  (#1096)  (David)

Page 43: Agavi (2010-07-31)

SUPPORT

• All classes, methods and properties are fully documented

• Tutorial manual and FAQs available

•Mailing Lists and IRC Channel for user support

• Commercial support, training and consulting available through Bitextender

Page 44: Agavi (2010-07-31)

AGAVI 1.0.4 AND1.1Release Roadmap

Page 45: Agavi (2010-07-31)

AGAVI 1.0.4

• Support for Microsoft Internet Information Services (IIS) 7 (with rewrites) and ext/sqlsrv

• Support for Windows Azure Platform

•New XSLT Renderer, takes previous content or returned value from view as the document, then transforms it

• Great for displaying return values from XML HTTP APIs!

• Exception pages support PHP 5.3 exception linking

Page 46: Agavi (2010-07-31)

AGAVI 1.1

• Authorization Layer

• Support for HipHop-PHP (already works, but needs tweaking)

•More support for Windows Azure platform (deployment)

• Hopefully: Storage subsystem with unified interface

•Maybe: Input types for HTTP

• First beta should be out in September

Page 47: Agavi (2010-07-31)

!e End

Page 48: Agavi (2010-07-31)

Questions?