cra / marketo-api
非官方Marketo API PHP库。
0.1.4
2024-04-25 14:20 UTC
Requires
- php: ^7.4 | ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- kint-php/kint: ^3.3
- phpunit/phpunit: ^9
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2024-09-25 15:23:51 UTC
README
非官方Marketo API PHP库。
安装
Composer
composer require cra/marketo-api
手动下载
在库目录中运行 composer install
,然后在项目中包含 PATH_TO_LIBRARY/vendor/autoload.php
。
使用方法
首先,您需要初始化和验证客户端。
use Cra\MarketoApi\Client; $client = (new Client($config))->authenticate();
$config
必须包含以下字段 restBaseUrl
、identityBaseUrl
、clientId
和 clientSecret
。有关字段的更多信息,请参阅下面的示例部分。
然后 $client
将传递给API端点类。例如:
use Cra\MarketoApi\Endpoint\Asset\Folder; $folderEndpoint = new Folder($client); $folder = $folderEndpoint->queryByName('My awesome folder'); $folders = $folderEndpoint->browse($folder->folderId());
示例
要从 /examples
目录运行示例,请将以下 config.json
文件放在存储库根目录中
{ "restBaseUrl": "REST BASE URL copied from Marketo dashboard including /rest", "identityBaseUrl": "REST BASE URL copied from Marketo dashboard including /identity", "clientId": "CLIENT ID from Marketo dashboard", "clientSecret": "CLIENT SECRET from Marketo dashboard" }