Difference between revisions of "GMOD RPC API/PHP"
(→rpc.php) |
(→rpc.php) |
||
Line 18: | Line 18: | ||
=== version directories === | === version directories === | ||
put everything else in a directory based on the version, e.g. v1 | put everything else in a directory based on the version, e.g. v1 | ||
− | ==== rpc.php ==== | + | ==== gmod-rpc/v1/rpc.php ==== |
All this does is parse the URL to instantiate a contoller object for the desired service and a view object. The class files live in | All this does is parse the URL to instantiate a contoller object for the desired service and a view object. The class files live in | ||
− | gmod-rpc/v1/sources/class.SourceName.php/ | + | |
− | gmod-rpc/v1/services/class. | + | ==== gmod-rpc/v1/sources/ ==== |
− | + | This will be where data source adaptors live | |
+ | class.SourceName.php/ | ||
+ | |||
+ | ==== gmod-rpc/v1/services/ ==== | ||
+ | This directory holds a base class | ||
+ | class.Service.php | ||
+ | implement additional services by adding object classes that extend this base class e.g. class.Organisms.php: | ||
+ | <php> | ||
+ | class Organisms extends Service{ | ||
+ | ... | ||
+ | </php> | ||
+ | Service class names should be ucfirst. | ||
+ | |||
+ | ==== gmod-rpc/v1/class.View.php ==== | ||
+ | A views object to generate xml or json |
Revision as of 23:57, 15 January 2010
Plans/Architecture for the PHP tools for implementing gmod-rpc
Contents
Components
index.php
gmod-rpc/index.php
Use mod_rewrite so that gmod-rpc URLs all go to this script
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^/gmod-rpc/.*$ /gmod-rpc/index.php </IfModule>
index.php looks for a version directory based on the URL.
class.myDomDocument.php
Very small class from Joe Grissom at Oklahoma for making XML. There is probably something more sophisticated that could be used in the future, but this works.
version directories
put everything else in a directory based on the version, e.g. v1
gmod-rpc/v1/rpc.php
All this does is parse the URL to instantiate a contoller object for the desired service and a view object. The class files live in
gmod-rpc/v1/sources/
This will be where data source adaptors live class.SourceName.php/
gmod-rpc/v1/services/
This directory holds a base class
class.Service.php
implement additional services by adding object classes that extend this base class e.g. class.Organisms.php: <php> class Organisms extends Service{ ... </php> Service class names should be ucfirst.
gmod-rpc/v1/class.View.php
A views object to generate xml or json