# fromGlobals

Learn how to create a storage from the PHP superglobals.

This static method creates a storage from the PHP superglobals, reading the cookies from the current request.

Use it in plain PHP scripts where the request cookies are available through the `$_COOKIE` superglobal.

## Signature

This method has the following signature:

```php
public static function fromGlobals(?CookieConfiguration $configuration = null, ?int $now = null): self
```

This method returns a new instance initialized with the client ID and user token read from the current request's cookies.

## Example

Here is a basic example of how to use this method:

```php
<?php
use Croct\Plug\CookieStorage;

$storage = CookieStorage::fromGlobals();
```

## Parameters

The following list describes the supported parameters:

- `configuration`: [`CookieConfiguration`](/reference/sdk/php/api/storage/cookie-configuration) (optional) (default: null)

  The cookie configuration, such as the cookie names and domain. The default is `null`, which uses the standard configuration.

- `now`: `integer` (optional) (default: null)

  The current time as a Unix timestamp in seconds, used to compute the cookie expiration. The default is `null`, which uses the current time.
