helgesverre / snov-io
Snov.io API 的 PHP/Laravel SDK
v1.0.1
2024-02-16 20:44 UTC
Requires
- php: ^8.2
- saloonphp/laravel-plugin: ^v3.0.0
- spatie/laravel-data: ^3.10
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- symfony/dom-crawler: ^7.0
README
Snov.io 的 Laravel 客户端
Snov.io Laravel 客户端允许 Laravel 应用与 Snov.io API 交互。
安装
您可以通过 composer 安装此包
composer require helgesverre/snov-io
您可以使用以下命令发布配置文件
php artisan vendor:publish --tag="snov-io"
这是已发布配置文件的内容
return [ 'client_id' => env('SNOV_CLIENT_ID'), 'client_secret' => env('SNOV_CLIENT_SECRET'), ];
用法
创建认证客户端
use HelgeSverre\Snov\Snov; // Instantiate the client $snov = new Snov( clientId: config('snov-io.client_id'), clientSecret: config('snov-io.client_secret'), ); // Authenticate the client $snov->authenticate($snov->getAccessToken()); // Call the API with a request $snov->send(new EmailCountRequest( domain: "snov.io", ));
创建认证客户端仅在您想要手动发送单个请求时使用客户端时才是必要的,如果您使用 Snov 类上的资源方法,客户端将自动进行认证。
$snov = new Snov( clientId: config('snov-io.client_id'), clientSecret: config('snov-io.client_secret'), ); // No need to authenticate the client, the resource method will do it automatically $snov->emailFinder()->emailCount( domain: "snov.io", );
使用 Facade
您还可以使用 Facade 访问 Snov.io API。
Snov::dripCampaigns(); Snov::emailFinder(); Snov::emailVerifier(); Snov::prospectManagement(); Snov::userAccount();
资源:滴灌营销
Snov::dripCampaigns()->changeRecipientsStatus($email, $campaignId, $status); Snov::dripCampaigns()->seeListOfCompletedProspects($campaignId); Snov::dripCampaigns()->seeCampaignReplies($campaignId); Snov::dripCampaigns()->getInfoAboutCampaignOpens($campaignId); Snov::dripCampaigns()->checkLinkClicks($campaignId); Snov::dripCampaigns()->viewSentEmails($campaignId); Snov::dripCampaigns()->addToDoNotEmailList($items, $listId);
资源:电子邮件查找器
Snov::emailFinder()->domainSearchV2($domain, $type, $limit, $lastId, $positions); Snov::emailFinder()->emailCount($domain); Snov::emailFinder()->emailFinder($firstName, $lastName, $domain); Snov::emailFinder()->addNamesToFindEmails($firstName, $lastName, $domain); Snov::emailFinder()->addURLToSearchForProspect($url); Snov::emailFinder()->getProspectWithURL($url); Snov::emailFinder()->getProfileWithEmail($email);
资源:电子邮件验证器
Snov::emailVerifier()->emailVerifier($emails) Snov::emailVerifier()->addEmailsForVerification($emails)
资源:潜在客户管理
Snov::prospectManagement()->addProspectToList( $email, $fullName, $firstName, $lastName, $phones, $country, $locality, $position, $companyName, $companySite, $updateContact, $customFields, $socialLinks, $listId, ); Snov::prospectManagement()->findProspectByID($id); Snov::prospectManagement()->findProspectByEmail($email); Snov::prospectManagement()->viewProspectsInList($listId, $page, $perPage); Snov::prospectManagement()->createNewProspectList($name);
资源:潜在客户管理
Snov::userAccount()->checkUserBalance();
资源:Webhooks
Snov::webhooks()->listAllWebhooks(); Snov::webhooks()->addWebhook($eventObject, $eventAction, $endpointUrl,); Snov::webhooks()->changeWebhookStatus($status,); Snov::webhooks()->deleteAWebhook();
开发
Snov.io 没有公开可用的 API 规范,但是他们的 API 文档结构相当清晰,可以抓取以生成类似 API 规范的东西,用于自动生成 SDK 的一部分。
资源:代码生成
使用 composer 脚本 codegen
运行代码生成,使用以下命令
composer codegen
它运行以下任务
# Generate the API spec php ./bin/generate.php # Generate the Resource and Request classes from the API spec php ./bin/codegen.php # Format the generated code composer format
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。