Download the PHP package sag/sag without Composer

On this page you can find all versions of the php package sag/sag. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sag

Sag

Note: I have not maintained this project for years since I no longer use CouchDB or PHP. I assume it still works with CouchDB, but haven't been active in the community for a while and won't be testing or responding to tickets.

Version %VERSION%

http://www.saggingcouch.com

Sag is a PHP library for working with CouchDB. It is designed to not force any particular programming method on its users - you just pass PHP objects, and get stdClass objects and Exceptions back. This makes it trivial to incorporate Sag into your application, build different functionality on top of it, and expand Sag to incorporate new CouchDB functionality.

Compatability

Each Sag release is tested with an automated testing suite against all the combinations of:

Lower versions of CouchDB and PHP will likely work with Sag, but they are not 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.

Error Handling

Sag's paradigm of simplicity is carried into its error handling by allowing you to send data to CouchDB that will result in errors (ex., malformed JSON). This is because CouchDB knows when there is an error better than Sag. This also makes Sag more future proof, instead of worrying about each of CouchDB's API changes. Therefore, Sag will only look for PHP interface problems and issues that are native to PHP, such as passing an int instead of a stdClass.

All errors are floated back to your application with Exceptions. Sag does not catch any errors itself, allowing your application to care about them or not.

There are two types of exceptions:

SagException For errors that happen within Sag, such as an invalid type being passed to a function or being unable to open a socket to the server.

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 HTTP status code will be the exception's code ($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 simply catching the Exception class.

Networking

Sag allows you to specify the HTTP library you want to use when communicating with CouchDB. The supported libraries are:

You can choose which library you want Sag to use by calling the 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 HTTP User-Agent header.

Results

When you have told Sag to decode CouchDB's responses (the default setting), 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:

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).

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 '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 as a stdClass.

Functions

Detailed documentation of the functions and API are available at http://www.saggingcouch.com/documentation.php.

License

Sag is released under the Apache License, version 2.0. See the file named LICENSE for more information.

Copyright information is in the NOTICE file.

More?

See http://www.saggingcouch.com for more detailed information, bug reporting, planned features, etc.


All versions of sag with dependencies

PHP Build Version
Package Version
Requires php Version >=5.2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sag/sag contains the following files

Loading the files please wait ....