【问题标题】:Contentful without Composer没有 Composer 的内容
【发布时间】:2016-07-06 07:02:25
【问题描述】:

我已经从 GitHub 上传了所有“Official PHP SDK for the Content Delivery API”文件和文件夹到我的服务器上名为“Contentful”的文件夹中。

然后我尝试按照 Contentful site 的教程进行操作,但是当然,我无法让它工作,因为我没有使用 Composer。

代码如下:

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);

在 GitHub 上,我找不到手动安装和初始化 SDK 的说明。

我真的很想在一个项目中使用 Contentful,但是作为一个初级 PHP 开发人员,对 Composer 一无所知,我需要指导。

任何好的灵魂都可以帮助我修改我的代码,以便我可以初始化 SDK 并开始从 Contentful API 检索数据?需要哪些文件?我需要做任何事情来自动加载类吗?这么多的疑问...

我的主人:Pagely。 我的工作区:Codeanywhere。

非常感谢。

【问题讨论】:

  • 谢谢你的帮助,伙计。

标签: php composer-php contentful


【解决方案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-06-22
    • 1970-01-01
    • 1970-01-01
    • 2016-12-02
    • 1970-01-01
    • 2021-10-24
    • 2014-10-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多