Permalink
Browse files

Add examples.

  • Loading branch information...
1 parent e4981d2 commit 97f64fe00c9ca86bf43806effe9513854fa2d18a @will-in-wi will-in-wi committed Sep 24, 2013
Showing with 25 additions and 3 deletions.
  1. +25 −3 Readme.md
View
@@ -4,14 +4,36 @@ A URL Parsing Library
This is a simple library for parsing, modifying, and reassembling a URL.
+Examples
+--------
+
+ $url = new URL('http://example.com/hello?a=123');
+ $url->addQueryString('b', '456');
+ echo $url->assemble();
+ # Output: http://example.com/hello?a=123&b=456
+
+To add array query strings:
+
+ $url = new URL('http://example.com/hello?a=123');
+ $url->addQueryString('b', array('456', '789'));
+ echo $url->assemble();
+ # Outputs: http://example.com/hello?a=123&b[]=456&b[]=789
+
+ $url = new URL('http://example.com/hello?a=123');
+ $url->addQueryString('b', '456');
+ $url->addQueryString('b', '789');
+ echo $url->assemble();
+ # Outputs: http://example.com/hello?a=123&b[]=456&b[]=789
+
+See tests for more possibilities.
+
To test
-------
-Go into test/ and run phpunit URL_test.php
+Go into `test/` and run `phpunit URL_test.php`
To generate docs
----------------
-In the root dir, run:
-phpdoc run -d . -t docs/ -i test/
+In the root dir, run: `phpdoc run -d . -t docs/ -i test/`

0 comments on commit 97f64fe

Please sign in to comment.