pdffiller / pdffiller-php-api-client
pdffiller.com REST API 的 PHP 客户端
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^7.4
- league/oauth2-client: ^2.6
- oodle/inflect: ^0.2.0
Requires (Dev)
- adammbalogh/key-value-store-file: ^0.5.3
- larapack/dd: ^1.0
- nesbot/carbon: ^2.31
- vlucas/phpdotenv: ^3.3|^5.4
- dev-master
- v3.2.0
- v3.1.0
- 3.0.1
- 3.0.0
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.x-dev
- 2.0.1
- 2.0.0
- 1.7.0
- 1.6.x-dev
- 1.6.2
- 1.6.1
- 1.6
- 1.5.0
- v1.4.0
- v1.3.0
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.1
- v1.0
- dev-feature/CORE-6186
- dev-dev-CORE-4898
- dev-feature/API-1976-fillable-field-property-fillable
- dev-feature/API-1854-fill-request-endpoints
- dev-fix/API-1852-fix-filled-form-export
- dev-fix/API-1837-fil-losing-l2f-additional-documents
- dev-fix/API-1836-add-application-fields
- dev-feature/API-1827-fix-fillable-fields
- dev-feature/API-1326-add-unit-tests
- dev-feature/API-1294-fix-comments
- dev-develop
- dev-feature/API-1255-remove-internal-grant
This package is auto-updated.
Last update: 2024-09-01 14:29:22 UTC
README
PDFfiller API 您可以在这里注册 API
系统要求
- PHP >= 7.0,但建议使用最新稳定版本的 PHP;
mbstring
扩展;intl
扩展;
安装
该库可在 Packagist 上获取,并可以使用 Composer 安装。在已安装 Composer 的环境中,运行以下命令即可完成此操作
$ composer require pdffiller/pdffiller-php-api-client
大多数现代框架都自带 Composer。但是,请确保包含以下文件
// Include the Composer autoloader require 'vendor/autoload.php';
故障排除
如果您遇到以下错误
[RuntimeException]
Could not load package pdffiller/pdffiller-php-api-client in http://packagi
st.org: [UnexpectedValueException] Could not parse version constraint ^5.2:
Invalid version string "^5.2"
[UnexpectedValueException]
Could not parse version constraint ^5.2: Invalid version string "^5.2"
尝试运行
composer self-update
您可能还会遇到以下情况
Warning: require_once(../../vendor/autoload.php): failed to open stream: No such file or directory
通过安装 composer 依赖项可以轻松解决这个问题
composer install
快速入门步骤
使用 composer 安装所需库
cd pdffiller-php-api-client/
composer install
编辑 examples 目录中的 .env 文件,设置 client_id、client_secret、用户名和密码(通过 password_grant
进行授权)
cd examples/
cp .env.example .env
vi .env
运行任何示例
cd signature_request/
php 1_get_signature_request_list.php
身份验证
访问令牌在成功从给定用户的凭据中检索到(在 PDFfiller\OAuth2\Client\Provider\PDFfiller::getAccessToken($grant_type, $options) 方法之后)时自动初始化,如下例所示
<?php require_once __DIR__.'/vendor/autoload.php'; use \PDFfiller\OAuth2\Client\Provider\Enums\GrantType; use \PDFfiller\OAuth2\Client\Provider\PDFfiller; $oauthParams = [ 'clientId' => 'YOUR_CLIENT_ID', 'clientSecret' => 'YOUR_CLIENT_SECRET', 'urlAccessToken' => 'https://api.pdffiller.com/v2/oauth/token', 'urlApiDomain' => 'https://api.pdffiller.com/v2/' ]; $passwordGrantCredentials = [ 'username' => 'pdffiller_account@example.com', 'password' => 'some_pass' ]; /** @var \PDFfiller\OAuth2\Client\Provider\PDFfiller $provider */ $provider = new PDFfiller($oauthParams); $accessToken = $provider->getAccessToken(GrantType::PASSWORD_GRANT, $passwordGrantCredentials); print_r($accessToken);
当您的授权成功完成时,您可以使用提供者检索、创建、更新或删除您配置文件中的信息。
用法
使用静态方法检索所有应用程序的列表:PDFfiller\OAuth2\Client\Provider\Core\Model::all(PDFfiller $provider)
$list = Application::all($provider); print_r($list);
要检索有关一个应用程序的信息,调用静态:PDFfiller\OAuth2\Client\Provider\Core\Model::one(PDFfiller $provider, $appClientId)
$application = Application::one($provider, 'app_client_id'); print_r($application);
如果您要创建一个新的应用程序,您必须创建一个新的 Application 对象并包含必要的信息,然后使用以下方法保存它:PDFfiller\OAuth2\Client\Provider\Core\Model::save()
$application = new Application($provider); $application->name = 'App name'; $application->description = 'Some application description'; $application->domain = 'http://some.domain.com'; print_r($application->save());
如果您要更新一个实例,您必须检索一个 Application 对象并使用以下方法保存它:PDFfiller\OAuth2\Client\Provider\Core\Model::save()
$application = Application::one($provider, 'app_client_id'); $application->name = 'Updated App name'; $application->description = 'Some changed application description'; $result = $application->save(); print_r($result);
通过使用 PDFfiller\OAuth2\Client\Provider\Core\Model::save()
方法,可以轻松地更新信息。如果您想删除一个应用程序,请使用:PDFfiller\OAuth2\Client\Provider\Core\Model::remove()
方法
$application = Application::one($provider, 'app_client_id'); $result = $application->remove(); print_r($result);
所有其他端点的示例都在 examples 文件夹中
支持
如果您有任何问题,请随时联系我们
- 在我们的问题页面 https://github.com/pdffiller/pdffiller-php-api-client/issues
- 通过我们的技术网站聊天或电话联系我们 http://developers.pdffiller.com
- 加入我们的 Gitter 聊天室以获取技术建议 https://gitter.im/pdffiller/pdffiller-php-api-client
许可
此软件受以下 MIT 许可 许可 的许可
作者
API 团队 (integrations@pdffiller.com)