---
title: "Stack"
description: "Stack"
url: "https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/php/reference/stack"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-13"
---

# Stack

## Stack

Stack Class to initialize the provided parameter Stack

## ContentType

To initialize the ContentType object from where the content will be fetched/retrieved.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$content_type = $stack->ContentType('content_type_uid');
```

Valid content type uid relevant to configured stack

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$content_types = $stack->ContentType();
```

## Assets

Assets Class to initalize your Assets

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$assets = $stack->Assets('asset_uid');
```

valid asset uid relevent to configured stack

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$assets = $stack->Assets();
```

## ImageTrasform

ImageTrasform function is define for image manipulation with different

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result_url = $stack->ImageTrasform('url', array('quality' => 100));
```

Image url on which we want to manipulate.

It is an second parameter in which we want to place different manipulation key and value in array form

## LivePreviewQuery

To set live preview token and content type uid.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->LivePreviewQuery(array('live_preview'=> 'token', 'content_type_uid'=? 'content_type_uid', 'entry_uid'=> 'entry_uid'));
```

Set live preview token and content type uid.

## getLastActivities

To get the last\_activity information of the configured environment from all the content types.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->getLastActivities();
```

## setHost

To set the host on stack object

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setHost('host');
```

Host name/ipaddress from where the content to be fetched

## getHost

This function returns host.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$host = $stack->getHost();
```

## setProtocol

This function sets protocol.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setProtocol('protocol');
```

Protocol type

## getProtocol

This function return protocol type.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$protocol = $stack->getProtocol();
```

## setPort

This function sets Port.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setPort('port');
```

Port Number

## getPort

This function return Port.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$port = $stack->getPort();
```

## setAPIKEY

This function sets API Key.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setAPIKEY('api_key');
```

Stack API key

## getAPIKEY

This function returns API Key.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$api_key = $stack->getAPIKEY();
```

## setDeliveryToken

This function sets Delivery Token.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setDeliveryToken('delivery_token');
```

Environment specific delivery token

## DeliveryToken

This function returns Delivery Token.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$token = $stack->DeliveryToken();
```

## setEnvironment

This function sets environment name.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setEnvironment('environment');
```

Name of Environment

## getEnvironment

This function returns environment name.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$environment = $stack->getEnvironment();
```

## setBranch

This function sets Branch.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$stack->setBranch('branch');
```

Name of branch

## Branch

This function returns Branch.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$branch = $stack->Branch();
```

## getContentTypes

This call returns comprehensive information of all the content types available in a particular stack in your account.

```
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->getContentTypes();
```

Query params for getting content-type.

## sync

Syncs your Contentstack data with your app and ensures that the data is always up-to-date by providing delta updates

```
For initializing sync:
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'init'=> true});For initializing sync with entries of a specific locale:
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'init'=> true, 'locale'=> 'en-us'});
For initializing sync with entries published after a specific date:
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'init'=> true, 'start_date'=> '2018-10-22'});
For initializing sync with entries of a specific content type:
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'init'=> true, 'content_type_uid'=> 'session'});
For initializing sync with specific type:
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'init'=> true, 'type'=> 'entry_published'});
For fetching the next batch of entries using pagination token:
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'pagination_token'=> '<page_token>'});
 For performing subsequent sync after initial sync:
use Contentstack\Contentstack;

$stack = Contentstack::Stack('api_key', 'delivery_token', 'environment');
$result = $stack->sync({'sync_token'=> '<sync_token>'})
```

initializing sync

initializing sync with entries of a specific locale

initializing sync with entries of a specific content type

Use the type parameter to get a specific type of content.Supports 'asset\_published', 'entry\_published', 'asset\_unpublished', 'entry\_unpublished', 'asset\_deleted', 'entry\_deleted', 'content\_type\_deleted'

Fetching the next batch of entries using pagination token

Performing subsequent sync after initial sync

## Stack | PHP Delivery SDK | Contentstack

The Stack class in the PHP Delivery SDK initializes a stack from the provided parameters, serving as the main interface to your Contentstack content.