Skip to content

Commit 5524148

Browse files
committed
Renamed index file
1 parent 68ed74f commit 5524148

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,30 @@ You need PHP version >= 5.5.0 or later installed to use the Contentstack PHP
1313

1414
### Setup and Installation
1515

16+
#### Install the library using [Composer](https://packagist.org/packages/contentstack/contentstack):
17+
To use the PHP SDK, you need to perform the following steps:
18+
19+
composer require contentstack/contentstack
20+
21+
To initialize the SDK, you will need to specify the API Key, Delivery Token, and Environment Name of your stack.
22+
23+
use Contentstack\Contentstack;
24+
$stack = Contentstack::Stack(API_KEY, DELIVERY_TOKEN, ENV_NAME);
25+
26+
27+
#### Download and install library:
1628
To use the PHP SDK, you need to perform the following steps:
1729

1830
1. Download/clone the PHP SDK from [here](https://www.contentstack.com/docs/platforms/php/php_sdk_latest).
1931
2. Paste the downloaded ZIP file of the PHP SDK to a folder of your choice.
2032

2133
To initialize the SDK, you will need to specify the API Key, Delivery Token, and Environment Name of your stack.
2234

23-
use Contentstack\Contentstack;include_once "contentstack/index.php";
35+
use Contentstack\Contentstack;
36+
include_once "contentstack/contentstack.php";
2437
$stack = Contentstack::Stack(API_KEY, DELIVERY_TOKEN, ENV_NAME);
2538

39+
2640
### Key Concepts for using Contentstack
2741

2842
#### Stack

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "contentstack/contentstack-php",
2+
"name": "contentstack/contentstack",
33
"description": "Contentstack is a headless CMS with an API-first approach that puts content at the centre. It is designed to simplify the process of publication by separating code from content.",
44
"type": "library",
55
"license": "MIT",

src/contentstack.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* Contentstack abstract class to provide access to Stack Object
4+
*
5+
* PHP version 5
6+
*
7+
* @category PHP
8+
* @package Contentstack
9+
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
10+
* @author Rohit Mishra <rhtmishra4545@gmail.com>
11+
* @copyright 2012-2020 Contentstack. All Rights Reserved
12+
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
13+
* @link https://pear.php.net/package/contentstack
14+
*/
15+
namespace Contentstack;
16+
17+
use Contentstack\Stack\Stack;
18+
19+
require_once __DIR__ . '/lib/models/stack.php';
20+
21+
/**
22+
* Contentstack abstract class to provide access to Stack Object
23+
*
24+
* @category PHP
25+
* @package Contentstack
26+
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
27+
* @author Rohit Mishra <rhtmishra4545@gmail.com>
28+
* @copyright 2012-2020 Contentstack. All Rights Reserved
29+
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
30+
* @link https://pear.php.net/package/contentstack
31+
*/
32+
abstract class Contentstack
33+
{
34+
/**
35+
* Static method for the Stack constructor
36+
*
37+
* @param string $api_key : Contentstack Stack API KEY.
38+
* @param string $access_token : Contentstack Stack ACCESS TOKEN.
39+
* @param string $environment : Environment Name.
40+
* @param ContentstackRegion $region : Region name of Contentstack.
41+
*
42+
* @return Stack
43+
* */
44+
public static function Stack($api_key = '',
45+
$access_token = '',
46+
$environment = '',
47+
$region = ''
48+
) {
49+
return new Stack($api_key, $access_token, $environment, $region);
50+
}
51+
}

0 commit comments

Comments
 (0)