Download the PHP package castanet/userid without Composer

On this page you can find all versions of the php package castanet/userid. 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 userid

Castanet_Userid

This library emulates Apahce's mod_uid or Nginx's User ID module. For the idea of User ID, visit these links.

Target Users

People who

Are you using Apache 1.x.x? or 2.0.x? Visit mod_uid page.

Are you using Nginx? Visit HttpUseridModule page.

Installation

Add below to your composer.json:

"require": {
    "castanet/userid": "*"
}

And then execute

composer install

Usage

PHP

require 'vendor/autoload.php';
$uid = new \Castanet_Userid;
$uid->enable()
    ->start();

You need to call \Castanet_Userid::start() as early as possible because it uses setrawcookie() function internally and setrawcookie() occurs error if you have output any string already.

Apache log

Add custome log format to httpd.conf like this:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{uid_got}n\" \"%{uid_set}n\"" combined_cookie

And set combined_cookie as current log format, then restart Apache.

uid_got and uid_set variables are set by this library.

Settings

Enabling

Castanet_Userid does nothing even start() is called unless you call enable()(or setEnabled(true)).

$uid = new Castanet_Userid;
$uid->start(); // do nothing
$uid->enable()->start(); // do something

Name(key of cookie)

name is used as key of cookie. By default, uid is used:

uid=fwAAAVEbtF1USQfEAwMEAg==

You can modify it by setConfig() method:

$uid->setConfig('name', 'castanet');

Then key of cookie is modified:

castanet=fwAAAVEbtF1USQfEAwMEAg==

Be careful not to use the same key already used for other purpose.

Service

service is an arbitrary integer and defaults to IP address of server PHP is processed(in practice, calculated by ip2long()). It appears as first eight characters on log. Let it, for instance, 127.0.0.1, and logs noted by this library(as uid_got and uid_set) start with characters 0100007F.

Characters themselves mean nothing but they play a role of identity. By seeing it, you may know the first server given user accessed. So you might have set the same value for multiple server load-balanced by one reverse proxy.

You can set service like this:

$uid->setConfig('service', ip2long('127.0.0.1'));

Cookie attributes

Cookie attributes(domain, path and expires) are able to be set by setConfig() method:

$uid->setConfig('domain', 'www.example.net')
    ->setConfig('path', '/sandbox');

Setting at a time

Using setConfigs() method, you can set properties above at a time:

$uid->setConfigs(array(
    'name'    => 'castanet',
    'service' => ip2long('127.0.0.1'),
    'domain'  => 'www.example.net',
    'path'    => '/sandbox'
));

Merged uid

Now Castanet Userid notes a note uid in addition to uid_set and uid_got. It is the value of either exists uid_set or uid_set and it doesn't have key name(uid=).

PHP 4

For PHP 4, Use Castanet_Userid4.

Contributors


All versions of userid with dependencies

PHP Build Version
Package Version
No informations.
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 castanet/userid contains the following files

Loading the files please wait ....