Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing Markdown formatting issues.

  • Loading branch information...
commit b81c26bdbda13341f86b3de41e0241a9005c7c08 1 parent 3ab0691
@sbisbee authored
Showing with 19 additions and 65 deletions.
  1. +19 −65 README.md
View
84 README.md
@@ -2,6 +2,7 @@ Sag
===
Version %VERSION%
+
http://www.saggingcouch.com
Sag is a PHP library for working with CouchDB. It is designed to not force any
@@ -28,53 +29,6 @@ officially supported, so your mileage may vary.
If you are running pre-1.5.1 CouchDB (important security fix) or pre-5.3 PHP,
then you probably want to look into updating your environment.
-Contents
---------
-
-CHANGELOG A detailed list of all changes between
- releases, including any breaking changes.
-
-LICENSE A copy of the license that Sag is released under.
-
-NOTICE Sag's copyright notice(s).
-
-README This file.
-
-Makefile Used to run unit tests, create releases, etc.
-
-examples/ Examples of how to use Sag.
-
-src/ This is the code that you will want to include
- in your application.
-
-src/Sag.php This is the core file that you will include()
- or require() in your code.
-
-src/SagException.php The SagException class. You don't need to
- include it.
-
-src/SagCouchException.php The SagCouchException class. You don't need to
- include it.
-
-src/SagCache.php The interface that all caching mechanisms
- extend. Include one of this interface's
- implementations instead of this file.
-
-src/SagFileCache.php Caching mechanism that uses the local file
- system.
-
-src/SagMemoryCache.php Caching mechanism that uses PHP objects in
- memory. Reported cache sizes are only
- semi-accurate, but are less important than file
- caching.
-
-src/SagUserUtils.php A set of utilities for interacting with CouchDB
- users and the _users database.
-
-tests/ The unit tests for Sag. You can ignore these
- files, though SagTests.php may be interesting
- for examples.
-
Error Handling
--------------
@@ -96,9 +50,9 @@ SagException For errors that happen within Sag, such as an invalid
SagCouchException For errors generated by CouchDB (ex., if you pass it
invalid JSON). The CouchDB error message will be put
- into the Exception's message ($e->getMessage()) and the
+ into the Exception's message (`$e->getMessage()`) and the
HTTP status code will be the exception's code
- ($e->getCode()).
+ (`$e->getCode()`).
You can catch these two types of exceptions explicitly, allowing you to split
your error handling depending on where the error occurred, or implicitly by
@@ -110,14 +64,14 @@ Networking
Sag allows you to specify the HTTP library you want to use when communicating
with CouchDB. The supported libraries are:
- - Native sockets (Sag::$NATIVE_HTTP_ADAPTER) - used by default. Prevent
- dependencies, such as cURL, that shared environments may not support.
+ - cURL (`Sag::$CURL_HTTP_ADAPTER`) - has functionality that native sockets do
+ not support, such as SSL. Used by default.
- - cURL (Sag::$CURL_HTTP_ADAPTER) - has functionality that native sockets do
- not support, such as SSL.
+ - Native sockets (`Sag::$NATIVE_HTTP_ADAPTER`). Prevent dependencies, such as
+ cURL, that shared environments may not support.
You can choose which library you want Sag to use by calling the
-setHTTPAdapter() function and passing it the appropriate variable.
+`setHTTPAdapter()` function and passing it the appropriate variable.
If you want to monitor your application's activity on the server side (ex., if
you are proxying requests to CouchDB through a web server), then examine the
@@ -131,7 +85,7 @@ they are stored in an object, breaking out the HTTP header lines and data. For
example, running `print_r($sag->get('/1'));` (where '/1' is the location of a
document) would give you something like this:
-``
+```
(
[headers] => stdClass Object
(
@@ -158,27 +112,27 @@ document) would give you something like this:
[status] => 200
)
-''
+```
HTTP protocol information is stored in $result->headers, its headers broken out
as entries in the headers array - the "_HTTP" array element holds the basic
-HTTP information in raw form ($result->headers->_HTTP->raw), and then broken
-out into HTTP version number ($result->headers->_HTTP->version) and status code
-($result->headers->_HTTP->status). The status code is also stored at the top of
-the response object ($result->status).
+HTTP information in raw form (`$result->headers->_HTTP->raw)`, and then broken
+out into HTTP version number (`$result->headers->_HTTP->version`) and status code
+(`$result->headers->_HTTP->status`). The status code is also stored at the top of
+the response object (`$result->status`).
-The $result->body property holds the raw data from CouchDB, which you can have
-Sag automatically decode into PHP objects with json_decode().
+The `$result->body` property holds the raw data from CouchDB, which you can have
+Sag automatically decode into PHP objects with `json_decode()`.
-The $result->body property holds the response body (usually JSON), which Sag
-will automatically decode with json_decode() when the content-type is
+The `$result->body` property holds the response body (usually JSON), which Sag
+will automatically decode with `json_decode()` when the content-type is
'application/json'.
If you've told Sag to not decode CouchDB's responses, then it'll only return
the resulting JSON from CouchDB as a string (what would have been in the body
property if you had set decode to true). None of the HTTP info is included.
-If CouchDB specifies Set-Cookies, then they will be stored in $result->cookies
+If CouchDB specifies Set-Cookies, then they will be stored in `$result->cookies`
as a stdClass.
Functions
Please sign in to comment.
Something went wrong with that request. Please try again.