2

I already uploaded all "Official PHP SDK for the Content Delivery API" files and folders, from GitHub, to a folder on my server named "Contentful".

Then I tried to follow the tutorial from Contentful site, but, of course, I could not make it work, because I did not use Composer.

The code is the following:

require_once 'vendor/autoload.php';

// This is the space ID. A space is like a project folder in Contentful terms
$space='developer_bookshelf';

// This is the access token for this space. Normally you get both ID and the     token in the Contentful web app
$token='0b7f6x59a0';

// This configures the SDK to access the Delivery API entry with the specified  ID from the space defined at the top, using a space-specific access token.
$client = new \Contentful\Delivery\Client($token, $space);

// This retrieves the entry with the specified ID and JSON encodes it
echo json_encode($client->getEntry('5PeGS2SoZGSa4GuiQsigQu'), JSON_PRETTY_PRINT);

On GitHub I could not find instructions to manually install and initialize the SDK.

I really want to use Contentful for a project, but as a beginner PHP developer, not knowing anything about Composer, I need directions.

Any good soul could help me modifying my code, so I can initialize SDK and begin retrieving data from Contentful API? Which files to require? Do I need to do anything to autoload classes? So many doubts...

My host: Pagely. My workspace: Codeanywhere.

Many thanks.

4

1 回答 1

1

好吧,我是这样做的:

1) Installed MAMPS on my Mac;
2) Installed Composer locally, running the script from [here][1];
3) Ran php composer.phar require contentful/contentful:@beta through Terminal;
4) Got all the files uploaded to my live server.

而已。

于 2016-03-19T21:25:39.753 回答