Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Luracast/Restler
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: telephone/Restler
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Apr 8, 2011

  1. Read Me text added

    Arul- committed Apr 8, 2011

    Verified

    This commit was signed with the committer’s verified signature.
    vikman90 Vikman Fernandez-Castro
    Copy the full SHA
    971e2d0 View commit details
  2. Change of extension

    Arul- committed Apr 8, 2011
    Copy the full SHA
    229a3b7 View commit details
  3. Copy the full SHA
    7b7aa6a View commit details
  4. Copy the full SHA
    d6a48e8 View commit details
  5. Copy the full SHA
    0ef4685 View commit details
  6. improving the documentation

    Arul- committed Apr 8, 2011
    Copy the full SHA
    df61f9d View commit details

Commits on Apr 9, 2011

  1. Moved the restler bundle to subfolder so that it can be downloaded wi…

    …thout examples and formats
    Arul- committed Apr 9, 2011
    Copy the full SHA
    6407133 View commit details

Commits on May 7, 2011

  1. Restler is now improved to support hosting in subfolders and mapping …

    …the paths relative to gateway (index.php)
    
    optional parameter support is greatly improved
    
    helloworld example updated
    Arul- committed May 7, 2011
    Copy the full SHA
    8898595 View commit details

Commits on May 10, 2011

  1. Copy the full SHA
    662cf6b View commit details

Commits on May 11, 2011

  1. Copy the full SHA
    1ea2119 View commit details

Commits on Aug 24, 2011

  1. Luracast Restler 2.0 is a major rewrite to use convention over config…

    …uration and it is optimized for performance. Here are some of the major changes and improvements.
    
    * PHPDoc comments to map a method to URI is now optional.
    * All public methods that does not begin with an underscore are mapped
      automatically to the method name (`gateway\classname\methodname\param1\...`)
    * If we do not specify the second parameter for `$restler->addAPIClass` it will be mapped to the
      class name instead of mapping it to the root
    * Restler 2 is written for PHP 5.3 and above but it make use of compat.php and work on
      any version of PHP starting from PHP 5.0
    Arul- committed Aug 24, 2011
    Copy the full SHA
    ce53f94 View commit details

Commits on Aug 25, 2011

  1. Adding minified version of RESTler 2 php files to restler_minified

    …folder for use on production server.
    Arul- committed Aug 25, 2011
    Copy the full SHA
    3aade21 View commit details

Commits on Sep 9, 2011

  1. Fix for wrong parameter order when api methods use parameters without…

    … default values. Thanks to @serrynaimo for finding this bug. Now parameters with out default vales will be set to NULL
    Arul- committed Sep 9, 2011
    Copy the full SHA
    e5da63d View commit details

Commits on Sep 20, 2011

  1. Improved the Examples documentation. Made them cleaner, and added a f…

    …ix for rendering HTML5 elements in IE8, added a menu bar to connect related urls
    Arul- committed Sep 20, 2011
    Copy the full SHA
    9b4048d View commit details

Commits on Sep 21, 2011

  1. Improved the minimal example to include parameter validation, .htacce…

    …ss file now makes sure that php display_errors is turned off in the server
    Arul- committed Sep 21, 2011
    Copy the full SHA
    e2913d4 View commit details

Commits on Sep 23, 2011

  1. Copy the full SHA
    b079fd2 View commit details

Commits on Sep 29, 2011

  1. API class was not getting an reference for Restler instance which is …

    …fixed in this patch and fixes #2 issue which required us to use spl_autoload or include_once to add the format file which is in the same folder as restler.php
    Arul- committed Sep 29, 2011
    Copy the full SHA
    a752f6b View commit details
  2. Copy the full SHA
    9746eb8 View commit details

Commits on Oct 14, 2011

  1. cleaned up the code to remove comments with # and initialize variable…

    … at line 506 properly with the value null and unwanted object creation
    Arul- committed Oct 14, 2011
    Copy the full SHA
    4cd3439 View commit details

Commits on Oct 18, 2011

  1. Fixes #11 a bug that is introduced in v2.0.3 which makes restler fail…

    … with the error "get_class() expects param 1 to be object, string given in restler.php on line 335"
    Arul- committed Oct 18, 2011
    Copy the full SHA
    c4717ca View commit details

Commits on Oct 30, 2011

  1. improved the examples documentation, corrected the stack overflow sup…

    …port url in the live examples
    Arul- committed Oct 30, 2011
    Copy the full SHA
    f8fac79 View commit details

Commits on Nov 9, 2011

  1. Improved JsonFormat to throw meaningful error messages when the JSON …

    …request is malformed. It will work on PHP 3.3 and above. Older versions will retain previous behavior.
    Arul- committed Nov 9, 2011
    Copy the full SHA
    e16417d View commit details
  2. Improved JsonFormat to throw meaningful error messages when the JSON …

    …request is malformed. It will work on PHP 5.3 and above. Older versions will retain previous behavior
    Arul- committed Nov 9, 2011
    Copy the full SHA
    f3dec8f View commit details
  3. Copy the full SHA
    b4fcc38 View commit details
  4. Copy the full SHA
    0da1475 View commit details
  5. Copy the full SHA
    882cd4d View commit details

Commits on Nov 13, 2011

  1. Copy the full SHA
    7059926 View commit details

Commits on Nov 19, 2011

  1. UTF8 encoding is now turned off by default for object_to_array.

    Extension in the middle of the URL is now supported.
    
    XmlFormat now does not use htmlentities and utf8encode.
    
    Fixes #6, Fixes #18, and Fixes #19
    Arul- committed Nov 19, 2011
    Copy the full SHA
    f2ef823 View commit details

Commits on Nov 20, 2011

  1. Fix for XmlFormat, which fails when the data contains special chars. F…

    …ixes #20.
    
    All format classes now use `self` instead of their classnames for static reference to improve portability.
    Arul- committed Nov 20, 2011
    Copy the full SHA
    175364f View commit details
  2. Fixes the critical bug that brakes the previous version. If you have …

    …downloaded 2.0.9, you must update to this release (2.1.0)
    Arul- committed Nov 20, 2011
    Copy the full SHA
    4111ec1 View commit details

Commits on Dec 4, 2011

  1. Updated the CRUD example with alternative DB options using Serialized…

    … File, SQLite, MySQL. Closes #7 which asks for persistent DB example.
    Arul- committed Dec 4, 2011
    Copy the full SHA
    08bc8dd View commit details

Commits on Jan 28, 2012

  1. Fixes #25 YAML format not working on case sensitive file systems. Ren…

    …amed the files to all lowercase and updated the include statements
    Arul- committed Jan 28, 2012
    Copy the full SHA
    9fb97cc View commit details

Commits on Jan 31, 2012

  1. Copy the full SHA
    0d1cc7e View commit details

Commits on Feb 11, 2012

  1. Copy the full SHA
    acb96dd View commit details

Commits on Feb 22, 2012

  1. Copy the full SHA
    c334e7e View commit details

Commits on Mar 4, 2012

  1. Fully implemented iResponse. Now we can globally customize the respon…

    …se structure for both success and error responses. Fixes #29
    Arul- committed Mar 4, 2012
    Copy the full SHA
    0823286 View commit details

Commits on Apr 21, 2012

  1. Minor update: Replaced ifModule in .htaccess files with IfModule (upp…

    …er case I). This fixes #41
    Arul- committed Apr 21, 2012
    Copy the full SHA
    daa024e View commit details

Commits on May 6, 2012

  1. Minor fixes to remove php error notifications in Restler::handle() (t…

    …hrown on some use cases) and DocParser:: formatClass() (thrown when @Class doc comment is used). Closes #42
    Arul- committed May 6, 2012
    Copy the full SHA
    b5bd1e1 View commit details

Commits on May 15, 2012

  1. This update makes class name, method name and parameter names case in…

    …sensitive in the url for better matching. Requested on http://bit.ly/MeaJkU
    Arul- committed May 15, 2012
    Copy the full SHA
    8ca901a View commit details

Commits on May 22, 2012

  1. Added support for namespaces (PHP 5.3 and above). Now you can use $r-…

    …>addApiClass('fully\qualified\path\Foo');
    Arul- committed May 22, 2012
    Copy the full SHA
    987b4fe View commit details

Commits on May 31, 2012

  1. Handle Accept headers.

    Application will now conneg on Accept headers as expectied.
    Also ensured that we only validate lower case values so client can send any mixture of case and it still works.
    Allow xml to be presented as text/xml as well as application/xml
    JSON can be requested as both application/jsot or application/javascript
    nickl- committed May 31, 2012
    Copy the full SHA
    24d9d18 View commit details

Commits on Jun 1, 2012

  1. Conneg based on q level.

    Included functionality to properly interpret the q=level supplied with multi-part Accept headers.
    nickl- committed Jun 1, 2012
    Copy the full SHA
    e740546 View commit details
  2. RFC 2616 conneg compliance and Vary definition.

    If no Accept header field is present, then it is assumed that the client accepts all media types. If an Accept header field is present, and if the server cannot send a response which is acceptable according to the combined Accept field value, then the server SHOULD send a 406 (not acceptable) response.
    
    A Vary field value consisting of a list of field-names signals that the representation selected for the response is based on a selection algorithm which considers ONLY the listed request-header field values in selecting the most appropriate representation. A cache MAY assume that the same selection will be made for future requests with the same values for the listed field names, for the duration of time for which the response is fresh.
    nickl- committed Jun 1, 2012
    Copy the full SHA
    7329dd4 View commit details

Commits on Jun 3, 2012

  1. Merge pull request #47 from nickl-/dev

    Better RFC 2616 compliance. Content Negotiation using Accept Header
    Arul- committed Jun 3, 2012
    Copy the full SHA
    ff9a55a View commit details
  2. Added a method for object which impliment JsonSerializable to not be

    auto converted to associative arrays
    Nigil Lee committed Jun 3, 2012
    Copy the full SHA
    66c7e0f View commit details

Commits on Jun 14, 2012

  1. Fixes #50 Syntax error, unexpected ':' in /home/dgersh/Restler/restle…

    …r/restler.php on line 545. Also updates version number to 2.1.8
    Arul- committed Jun 14, 2012
    Copy the full SHA
    b31ad22 View commit details

Commits on Jun 20, 2012

  1. Copy the full SHA
    73b8e8a View commit details

Commits on Jun 30, 2012

  1. Copy the full SHA
    0027ad8 View commit details
  2. Added Nginx .conf example

    telephone committed Jun 30, 2012
    Copy the full SHA
    2aa1207 View commit details
  3. Copy the full SHA
    dd8b62c View commit details
Showing with 11,709 additions and 0 deletions.
  1. 0 README
  2. +64 −0 README.html
  3. +48 −0 README.md
  4. +11 −0 examples/_001_helloworld/.htaccess
  5. +14 −0 examples/_001_helloworld/index.php
  6. +119 −0 examples/_001_helloworld/readme.html
  7. +63 −0 examples/_001_helloworld/readme.md
  8. +6 −0 examples/_001_helloworld/say.php
  9. +11 −0 examples/_002_minimal/.htaccess
  10. +23 −0 examples/_002_minimal/index.php
  11. +29 −0 examples/_002_minimal/math.php
  12. +115 −0 examples/_002_minimal/readme.html
  13. +64 −0 examples/_002_minimal/readme.md
  14. +11 −0 examples/_003_multiformat/.htaccess
  15. +37 −0 examples/_003_multiformat/bmi.php
  16. +72 −0 examples/_003_multiformat/index.php
  17. +140 −0 examples/_003_multiformat/readme.html
  18. +86 −0 examples/_003_multiformat/readme.md
  19. +11 −0 examples/_004_error_response/.htaccess
  20. +11 −0 examples/_004_error_response/currency.php
  21. +44 −0 examples/_004_error_response/index.php
  22. +121 −0 examples/_004_error_response/readme.html
  23. +59 −0 examples/_004_error_response/readme.md
  24. +11 −0 examples/_005_protected_api/.htaccess
  25. +43 −0 examples/_005_protected_api/index.php
  26. +118 −0 examples/_005_protected_api/readme.html
  27. +63 −0 examples/_005_protected_api/readme.md
  28. +10 −0 examples/_005_protected_api/secured.php
  29. +15 −0 examples/_005_protected_api/simple.php
  30. +10 −0 examples/_005_protected_api/simpleauth.php
  31. +11 −0 examples/_006_crud/.htaccess
  32. +38 −0 examples/_006_crud/author.php
  33. +110 −0 examples/_006_crud/db_pdo_mysql.php
  34. +85 −0 examples/_006_crud/db_pdo_sqlite.php
  35. +96 −0 examples/_006_crud/db_serialized_file.php
  36. +70 −0 examples/_006_crud/db_session.php
  37. +169 −0 examples/_006_crud/index.php
  38. +245 −0 examples/_006_crud/readme.html
  39. +179 −0 examples/_006_crud/readme.md
  40. +116 −0 examples/index.html
  41. BIN examples/resources/Luracast.gif
  42. BIN examples/resources/Luracast.png
  43. BIN examples/resources/Luracast_dark.png
  44. BIN examples/resources/Restler2.gif
  45. BIN examples/resources/ZeroClipboard.swf
  46. BIN examples/resources/closelabel.png
  47. +80 −0 examples/resources/facebox.css
  48. +309 −0 examples/resources/facebox.js
  49. +41 −0 examples/resources/getsource.php
  50. +13 −0 examples/resources/hacks.css
  51. +18 −0 examples/resources/jquery-1.6.2.min.js
  52. +40 −0 examples/resources/jquery.snippet.min.css
  53. +12 −0 examples/resources/jquery.snippet.min.js
  54. BIN examples/resources/loading.gif
  55. BIN examples/resources/restler_flow.png
  56. +432 −0 examples/resources/style.css
  57. +27 −0 examples/sample.nginx.conf
  58. +87 −0 restler/amfformat/Zend/Amf/Constants.php
  59. +424 −0 restler/amfformat/Zend/Amf/Parse/Amf3/Deserializer.php
  60. +507 −0 restler/amfformat/Zend/Amf/Parse/Amf3/Serializer.php
  61. +65 −0 restler/amfformat/Zend/Amf/Parse/Deserializer.php
  62. +39 −0 restler/amfformat/Zend/Amf/Parse/InputStream.php
  63. +49 −0 restler/amfformat/Zend/Amf/Parse/OutputStream.php
  64. +59 −0 restler/amfformat/Zend/Amf/Parse/Serializer.php
  65. +231 −0 restler/amfformat/Zend/Amf/Parse/TypeLoader.php
  66. +285 −0 restler/amfformat/Zend/Amf/Util/BinaryStream.php
  67. +92 −0 restler/amfformat/Zend/Amf/Value/Messaging/AbstractMessage.php
  68. +60 −0 restler/amfformat/Zend/Amf/Value/Messaging/AcknowledgeMessage.php
  69. +43 −0 restler/amfformat/Zend/Amf/Value/Messaging/AsyncMessage.php
  70. +119 −0 restler/amfformat/Zend/Amf/Value/Messaging/CommandMessage.php
  71. +67 −0 restler/amfformat/Zend/Amf/Value/Messaging/ErrorMessage.php
  72. +73 −0 restler/amfformat/Zend/Amf/Value/Messaging/RemotingMessage.php
  73. +70 −0 restler/amfformat/amfformat.php
  74. +58 −0 restler/compat.php
  75. +970 −0 restler/plistformat/CFBinaryPropertyList.php
  76. +586 −0 restler/plistformat/CFPropertyList.php
  77. +742 −0 restler/plistformat/CFType.php
  78. +167 −0 restler/plistformat/CFTypeDetector.php
  79. +99 −0 restler/plistformat/IOException.php
  80. +22 −0 restler/plistformat/PListException.php
  81. +86 −0 restler/plistformat/plistformat.php
  82. +1,554 −0 restler/restler.php
  83. +213 −0 restler/xmlformat.php
  84. +19 −0 restler/yamlformat/LICENSE
  85. +15 −0 restler/yamlformat/README.markdown
  86. +137 −0 restler/yamlformat/sfyaml.php
  87. +60 −0 restler/yamlformat/sfyamldumper.php
  88. +442 −0 restler/yamlformat/sfyamlinline.php
  89. +622 −0 restler/yamlformat/sfyamlparser.php
  90. +47 −0 restler/yamlformat/yamlformat.php
  91. +2 −0 restler_minified/amfformat/Zend/Amf/Constants.php
  92. +2 −0 restler_minified/amfformat/Zend/Amf/Parse/Amf3/Deserializer.php
  93. +2 −0 restler_minified/amfformat/Zend/Amf/Parse/Amf3/Serializer.php
  94. +2 −0 restler_minified/amfformat/Zend/Amf/Parse/Deserializer.php
  95. +2 −0 restler_minified/amfformat/Zend/Amf/Parse/InputStream.php
  96. +2 −0 restler_minified/amfformat/Zend/Amf/Parse/OutputStream.php
  97. +2 −0 restler_minified/amfformat/Zend/Amf/Parse/Serializer.php
  98. +2 −0 restler_minified/amfformat/Zend/Amf/Parse/TypeLoader.php
  99. +2 −0 restler_minified/amfformat/Zend/Amf/Util/BinaryStream.php
  100. +2 −0 restler_minified/amfformat/Zend/Amf/Value/Messaging/AbstractMessage.php
  101. +2 −0 restler_minified/amfformat/Zend/Amf/Value/Messaging/AcknowledgeMessage.php
  102. +2 −0 restler_minified/amfformat/Zend/Amf/Value/Messaging/AsyncMessage.php
  103. +2 −0 restler_minified/amfformat/Zend/Amf/Value/Messaging/CommandMessage.php
  104. +2 −0 restler_minified/amfformat/Zend/Amf/Value/Messaging/ErrorMessage.php
  105. +2 −0 restler_minified/amfformat/Zend/Amf/Value/Messaging/RemotingMessage.php
  106. +2 −0 restler_minified/amfformat/amfformat.php
  107. +2 −0 restler_minified/compat.php
  108. +2 −0 restler_minified/plistformat/CFBinaryPropertyList.php
  109. +2 −0 restler_minified/plistformat/CFPropertyList.php
  110. +2 −0 restler_minified/plistformat/CFType.php
  111. +2 −0 restler_minified/plistformat/CFTypeDetector.php
  112. +2 −0 restler_minified/plistformat/IOException.php
  113. +2 −0 restler_minified/plistformat/PListException.php
  114. +2 −0 restler_minified/plistformat/plistformat.php
  115. +6 −0 restler_minified/restler.php
  116. +2 −0 restler_minified/xmlformat.php
  117. +2 −0 restler_minified/yamlformat/sfyaml.php
  118. +2 −0 restler_minified/yamlformat/sfyamldumper.php
  119. +16 −0 restler_minified/yamlformat/sfyamlinline.php
  120. +2 −0 restler_minified/yamlformat/sfyamlparser.php
  121. +2 −0 restler_minified/yamlformat/yamlformat.php
Empty file removed README
Empty file.
64 changes: 64 additions & 0 deletions README.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

<!DOCTYPE html>
<html>
<head>
<title>Luracast Restler 2.0 Example:- CRUD</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="examples/resources/markdown.css"/>
</head>
<body>
<article>
<h1>Luracast Restler 2.0</h1>

<p>Restler is a simple and effective multi-protocol REST API Server written in PHP.
Just deal with your business logic in php, restler will take care of the REST!</p>

<ul>
<li><a href="http://luracast.com/products/restler/" target="_blank">Developer Home</a></li>
<li><a href="http://bit.ly/RestlerLiveExamples" target="_blank">Live Examples</a></li>
<li><a href="http://bit.ly/TakingCareOfTheREST" target="_blank">Taking Care of the REST - Presentation</a></li>
<li><a href="http://bit.ly/SingMood" target="_blank">Open Sourced Real World Example - SingMood</a></li>
<li><a href="http://twitter.com/Luracast" target="_blank">Updates on Twitter</a></li>
</ul>

<h2>Features</h2>

<ul>
<li>Light weight</li>
<li>Flexible</li>
<li>Customizable</li>
<li>Supports HTTP request methods GET, POST, PUT, and DELETE</li>
<li>Clients can use X-HTTP-Method-Override header</li>
<li>Two way format conversion</li>
<li>Pluggable Formatters</li>
<li>Comes with JSON, XML, Yaml, Amf, and Plist(both XML and Binary) formats</li>
<li>Pluggable Authentication schemes</li>
<li>Comes with many <a href="http://bit.ly/RestlerLiveExamples" target="_blank">Examples</a>
that can be tried on your localhost to get started</li>
<li>URL to Method mapping</li>
<li>URL part to Method parameter mapping</li>
<li>Supports URLEncoded format for simplified input</li>
<li>Query parameters to Method parameter mapping</li>
<li>Source code distributed under LGPL</li>
</ul>

<h2>Changes from Restler 1.0</h2>

<p>Restler 2.0 is a major rewrite to use convention over configuration and it is optimized
for performance. Here are some of the major changes and improvements</p>

<ul>
<li>PHPDoc comments to map a method to URI is now optional.</li>
<li>All public methods that does not begin with an underscore are mapped
automatically to the method name (<code>gateway\classname\methodname\param1\...</code>)</li>
<li>If we do not specify the second parameter for <code>$restler-&gt;addAPIClass</code> it will be mapped to the
class name instead of mapping it to the root</li>
<li>Restler 2 is written for PHP 5.3 and above but it make use of compat.php and work on
any version of PHP starting from PHP 5.0</li>
</ul>

<p>more information is available on the
<a href="http://luracast.com/products/restler/features/" target="_blank">features page</a>
</article>
</body>
</html></p>
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Luracast Restler 2.0
====================

Restler is a simple and effective multi-protocol REST API Server written in PHP.
Just deal with your business logic in php, restler will take care of the REST!

* [Developer Home](http://luracast.com/products/restler/)
* [Live Examples](http://bit.ly/RestlerLiveExamples)
* [Taking Care of the REST - Presentation](http://bit.ly/TakingCareOfTheREST)
* [Open Sourced Real World Example - SingMood](http://bit.ly/SingMood)
* [Updates on Twitter](http://twitter.com/Luracast)

Features
--------

* Light weight
* Flexible
* Customizable
* Supports HTTP request methods GET, POST, PUT, and DELETE
* Clients can use X-HTTP-Method-Override header
* Two way format conversion
* Pluggable Formatters
* Comes with JSON, XML, Yaml, Amf, and Plist(both XML and Binary) formats
* Pluggable Authentication schemes
* Comes with many [Examples](http://bit.ly/RestlerLiveExamples)
that can be tried on your localhost to get started
* URL to Method mapping
* URL part to Method parameter mapping
* Supports URLEncoded format for simplified input
* Query parameters to Method parameter mapping
* Source code distributed under LGPL

Changes from Restler 1.0
------------------------

Restler 2.0 is a major rewrite to use convention over configuration and it is optimized
for performance. Here are some of the major changes and improvements

* PHPDoc comments to map a method to URI is now optional.
* All public methods that does not begin with an underscore are mapped
automatically to the method name (`gateway\classname\methodname\param1\...`)
* If we do not specify the second parameter for `$restler->addAPIClass` it will be mapped to the
class name instead of mapping it to the root
* Restler 2 is written for PHP 5.3 and above but it make use of compat.php and work on
any version of PHP starting from PHP 5.0

more information is available on the
[features page](http://luracast.com/products/restler/features/)
11 changes: 11 additions & 0 deletions examples/_001_helloworld/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule mod_php5.c>
php_flag display_errors Off
</IfModule>
14 changes: 14 additions & 0 deletions examples/_001_helloworld/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/*
Title: Hello World Example.
Tagline: Let's say hello!.
Description: Basic hello world example to get started with Restler 2.0.
Example 1: GET say/hello returns "Hello world!".
Example 2: GET say/hello/Restler2.0 returns "Hello Restler2.0!".
Example 3: GET say/hello?to=R.Arul%20Kumaran returns "Hello R.Arul Kumaran!".
*/
require_once '../../restler/restler.php';
require_once 'say.php';
$r = new Restler();
$r->addAPIClass('Say');
$r->handle();
119 changes: 119 additions & 0 deletions examples/_001_helloworld/readme.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<!DOCTYPE html>
<html>
<head>
<title>Luracast Restler 2.0 Example:- Hello World Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../resources/style.css"/>
<link rel="stylesheet" type="text/css" href="../resources/jquery.snippet.min.css"/>
<link rel="stylesheet" type="text/css" href="../resources/facebox.css"/>
<link rel="stylesheet" type="text/css" href="../resources/hacks.css"/>

<script type="text/javascript" src="../resources/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../resources/jquery.snippet.min.js"></script>
<script type="text/javascript" src="../resources/facebox.js"></script>

<script type="text/javascript">
$(document).ready(function(){
//$('a[target*=_blank]').facebox();
$("abbr").click(function(){
$('#codeviewer').load('../resources/getsource.php?file='+$(this).attr("title"), function(){
$("pre#php").snippet("php",{style:"acid",showNum:false});
jQuery.facebox({ div: '#codeviewer' });
});
});
})
</script>
<!--[if lte IE 8]>
<script type="text/javascript">
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(',');for(var i=0;i<e.length;i++){document.createElement(e[i])}})()
</script>
<![endif]-->
</head>
<body>
<nav class="floating-menu">
<ul>
<li><a title="Restler Home" href="http://luracast.com/products/restler/">Home</a></li>
<!--<li><a title="Using Restler" href="#">Guide</a></li><li><a title="Restler API Reference" href="#">API</a></li>-->
<li><a class="active" href="../index.html">Examples</a></li>
<li><a title="Share your knowledge by answering user questions in Stack Overflow." href="http://bit.ly/Restler-QA">Support</a></li>
<li><a title="Contribute and Fork Restler on GitHub" href="http://bit.ly/LuracastRestler">GitHub</a></li>
<li><a title="Get updated on Twitter" href="http://twitter.com/Luracast">Twitter</a></li>
</ul>
</nav>
<div id="codeviewer" style="display:none;"></div>
<nav id="left">
<img src="../resources/Restler2.gif" width="126" height="126" title="Luracast Restler 2.0"/>
<h3><a href="../index.html">Examples</a></h3>
<ul><li><a href="../_001_helloworld/readme.html" title="Let's say hello!">Hello World</a></li><li><a href="../_002_minimal/readme.html" title="Less is more">Minimal</a></li><li><a href="../_003_multiformat/readme.html" title="Serving what the client wants">Multi-format</a></li><li><a href="../_004_error_response/readme.html" title="Making use of HTTP status codes">Error Response</a></li><li><a href="../_005_protected_api/readme.html" title="Creating restricted zone">Protected API</a></li><li><a href="../_006_crud/readme.html" title="using POST, GET, PUT and DELETE">CRUD</a></li></ul>
</nav>
<article id="right">
<div class="right"><small>1</small></div>
<h2>Hello World Example</h2>

<p>Basic hello world example to get started with Restler 2.0</p>

<blockquote>
<p>This API Server is made using the following php files/folders</p>

<ul>
<li><abbr title="_001_helloworld/index.php">index.php</abbr> (gateway)</li>
<li><abbr title="_001_helloworld/say.php">say.php</abbr> (api)</li>
<li><abbr title="../restler/restler.php">restler.php</abbr> (framework)</li>
</ul>
</blockquote>

<p>This API Server exposes the following URIs</p>

<pre><code>GET say/hello ⇠ Say::hello()
GET say/hello/:to ⇠ Say::hello()
</code></pre>

<p>Try the following links in your browser</p>

<dl>
<dt>GET <a href="say/hello" target="_blank">say/hello</a></dt>
<dd>
<pre><code>"Hello world!"
</code></pre>
</dd>

<dt>GET <a href="say/hello/Restler2.0" target="_blank">say/hello/Restler2.0</a></dt>
<dd><pre><code>"Hello Restler2.0!"
</code></pre></dd>

<dl>
<dt>GET <a href="say/hello?to=R.Arul%20Kumaran" target="_blank">say/hello?to=R.Arul%20Kumaran</a></dt>
<dd>
<pre><code>"Hello R.Arul Kumaran!"
</code></pre>
</dd>
</dl>

<p>If the above links fail, it could be due to missing <code>.htaccess</code> file or URL Rewriting is not supported in your server.
Try the following links instead</p>

<dl>
<dt>GET <a href="index.php/say/hello" target="_blank"><abbr title="_001_helloworld/index.php">index.php</abbr>/say/hello</a></dt>
<dd>
<pre><code>"Hello world!"
</code></pre>
</dd>

<dt>GET <a href="index.php/say/hello/Restler2.0" target="_blank"><abbr title="_001_helloworld/index.php">index.php</abbr>/say/hello/Restler2.0</a></dt>
<dd><pre><code>"Hello Restler2.0!"
</code></pre></dd>

<dl>
<dt>GET <a href="index.php/say/hello?to=R.Arul%20Kumaran" target="_blank"><abbr title="_001_helloworld/index.php">index.php</abbr>/say/hello?to=R.Arul%20Kumaran</a></dt>
<dd>
<pre><code>"Hello R.Arul Kumaran!"
</code></pre>
</dd>
</dl>

</article>
<footer>
&#169; 2010 <a title="Luracast.com" href="http://luracast.com"><img src="../resources/Luracast_dark.png" width="180" height="32" title="Helping Developers with Tools, Utilities, Frameworks and Services"/></a>
</footer>
</body>
</html>
63 changes: 63 additions & 0 deletions examples/_001_helloworld/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Hello World Example
-------------------

Basic hello world example to get started with Restler 2.0
> This API Server is made using the following php files/folders
> * index.php (gateway)
> * say.php (api)
> * restler.php (framework)
This API Server exposes the following URIs

GET say/hello ⇠ Say::hello()
GET say/hello/:to ⇠ Say::hello()


Try the following links in your browser

GET [say/hello](say/hello)
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Hello world!"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GET [say/hello/Restler2.0](say/hello/Restler2.0)
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Hello Restler2.0!"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GET [say/hello?to=R.Arul%20Kumaran](say/hello?to=R.Arul%20Kumaran)
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Hello R.Arul Kumaran!"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


If the above links fail, it could be due to missing `.htaccess` file or URL Rewriting is not supported in your server.
Try the following links instead

GET [index.php/say/hello](index.php/say/hello)
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Hello world!"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GET [index.php/say/hello/Restler2.0](index.php/say/hello/Restler2.0)
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Hello Restler2.0!"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GET [index.php/say/hello?to=R.Arul%20Kumaran](index.php/say/hello?to=R.Arul%20Kumaran)
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Hello R.Arul Kumaran!"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



*[index.php]: _001_helloworld/index.php
*[say.php]: _001_helloworld/say.php
*[restler.php]: ../restler/restler.php
6 changes: 6 additions & 0 deletions examples/_001_helloworld/say.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
class Say {
function hello($to='world') {
return "Hello $to!";
}
}
11 changes: 11 additions & 0 deletions examples/_002_minimal/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule mod_php5.c>
php_flag display_errors Off
</IfModule>
23 changes: 23 additions & 0 deletions examples/_002_minimal/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/*
Tagline: Less is more.
Description: Shows the bare minimum code needed to get your RESTful api server up and running.
Example 1: GET math/add returns 2.
Example 2: GET math/add/4/3 returns 7.
Example 3: GET math/add?n1=6&n2=4 returns 10.
Example 4: GET math/multiply returns {"result":10}.
Example 5: GET math/multiply/4/3 returns {"result":12}.
Example 6: GET math/multiply?n2=4 returns {"result":20}.
*/

#add restler to include path
set_include_path(get_include_path() . PATH_SEPARATOR . '../../restler');

#set autoloader
#do not use spl_autoload_register with out parameter
#it will disable the autoloading of formats
spl_autoload_register('spl_autoload');

$r = new Restler();
$r->addAPIClass('Math');
$r->handle();
Loading