Permalink
Browse files

changed read me to markdown

  • Loading branch information...
freekrai committed Mar 21, 2012
1 parent 1f48371 commit 1b0647979de3833d35f3221d117a19e565db3b69
Showing with 47 additions and 44 deletions.
  1. +0 −44 README
  2. +47 −0 README.md
View
44 README
@@ -1,44 +0,0 @@
-Lawnchair.php is a port of PHP port of Lawnchair.js
-
-See http://westcoastlogic.com/lawnchair/ for the original javascript library.
-
-I mostly made this for something to try, and have tested with over 20,000 records in a table and had it work fast.
-
-You have a choice of adapters, it can store it as text files or in a mySQL database, and you can build on that.
-
-I'll do more documentation as I go..
-
-This also works really nicely with underscore.php
-
- <?php
- include("Lawnchair.php");
- $ppl = new Lawnchair( array("name"=>"people","store"=>"file") );
- if( $ppl->count() < 1 ){
- $ppl->save( array("value"=>array("name"=>"Roger") ) );
- $ppl->save( array("value"=>array("name"=>"Kaitlyn") ) );
- $ppl->save( array("value"=>array("name"=>"Patsy") ) );
- $ppl->save( array("value"=>array("name"=>"Bailey") ) );
- for($i = 0; $i <= 15000;$i++){
- $ppl->save( array("value"=>array("name"=>$i) ) );
- }
- }
- echo "<h1>List all Keys</h1>";
- if( $ppl->count() < 10 ){
- echo "<pre>".print_r($ppl->keys(),true)."</pre>";
- }else{
- echo "<p>Too many keys to list at once.. {$ppl->count()} keys found..</p>";
- }
- echo "<h1>Find all people with 'a' in the name </h1>";
- $list = $ppl->find(array("field"=>"name","q"=>"a","a"=>"eq"));
- echo "<pre>".print_r($list,true)."</pre>";
- echo "<h1>List All People</h1>";
- echo "<pre>".print_r($ppl->all(),true)."</pre>";
-
- echo "Last Record is: ".print_r($ppl->max(),true)."<br />";
- echo "Last Key is: ".$ppl->lastid();
-
- echo "<h1>Max with callback</h1>";
- echo "----> ".$ppl->max( function($member) { return "My name is: ".$member['name']; } )."<br />";
-
- echo "<h1>Delete all records</h1>";
- $ppl->nuke();
View
@@ -0,0 +1,47 @@
+Lawnchair.php is a port of PHP port of Lawnchair.js
+
+See http://westcoastlogic.com/lawnchair/ for the original javascript library.
+
+I mostly made this for something to try, and have tested with over 20,000 records in a table and had it work fast.
+
+You have a choice of adapters, it can store it as text files or in a mySQL database, and you can build on that.
+
+I'll do more documentation as I go..
+
+This also works really nicely with underscore.php
+
+Example
+--------
+
+ <?php
+ include("Lawnchair.php");
+ $ppl = new Lawnchair( array("name"=>"people","store"=>"file") );
+ if( $ppl->count() < 1 ){
+ $ppl->save( array("value"=>array("name"=>"Roger") ) );
+ $ppl->save( array("value"=>array("name"=>"Kaitlyn") ) );
+ $ppl->save( array("value"=>array("name"=>"Patsy") ) );
+ $ppl->save( array("value"=>array("name"=>"Bailey") ) );
+ for($i = 0; $i <= 15000;$i++){
+ $ppl->save( array("value"=>array("name"=>$i) ) );
+ }
+ }
+ echo "<h1>List all Keys</h1>";
+ if( $ppl->count() < 10 ){
+ echo "<pre>".print_r($ppl->keys(),true)."</pre>";
+ }else{
+ echo "<p>Too many keys to list at once.. {$ppl->count()} keys found..</p>";
+ }
+ echo "<h1>Find all people with 'a' in the name </h1>";
+ $list = $ppl->find(array("field"=>"name","q"=>"a","a"=>"eq"));
+ echo "<pre>".print_r($list,true)."</pre>";
+ echo "<h1>List All People</h1>";
+ echo "<pre>".print_r($ppl->all(),true)."</pre>";
+
+ echo "Last Record is: ".print_r($ppl->max(),true)."<br />";
+ echo "Last Key is: ".$ppl->lastid();
+
+ echo "<h1>Max with callback</h1>";
+ echo "----> ".$ppl->max( function($member) { return "My name is: ".$member['name']; } )."<br />";
+
+ echo "<h1>Delete all records</h1>";
+ $ppl->nuke();

0 comments on commit 1b06479

Please sign in to comment.