helgesverre / snov-io
PHP/Laravel SDK for the Snov.io API
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
Laravel Client for Snov.io
The Snov.io Laravel Client enables laravel applications to interact with the Snov.io API.
Installation
You can install the package via composer:
composer require helgesverre/snov-io
You can publish the config file with:
php artisan vendor:publish --tag="snov-io"
This is the contents of the published config file:
return [ 'client_id' => env('SNOV_CLIENT_ID'), 'client_secret' => env('SNOV_CLIENT_SECRET'), ];
Usage
Creating an authenticated client
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", ));
Creating an authenticated client is only necessary if you want to use the client to send individual requests manually, if you use the resource methods on the Snov class, the client will be authenticated automatically.
$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", );
Using the Facade
You can also use the Facade to access the Snov.io API.
Snov::dripCampaigns(); Snov::emailFinder(); Snov::emailVerifier(); Snov::prospectManagement(); Snov::userAccount();
Resource: Drip Campaigns
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);
Resource: Email Finder
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);
Resource: Email Verifier
Snov::emailVerifier()->emailVerifier($emails) Snov::emailVerifier()->addEmailsForVerification($emails)
Resource: Prospect Management
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);
Resource: Prospect Management
Snov::userAccount()->checkUserBalance();
Resource: Webhooks
Snov::webhooks()->listAllWebhooks(); Snov::webhooks()->addWebhook($eventObject, $eventAction, $endpointUrl,); Snov::webhooks()->changeWebhookStatus($status,); Snov::webhooks()->deleteAWebhook();
Development
Snov.io does not have an API specification publicly available, however their API docs are fairly structured and can be scraped to generate something resembling an API spec that can be used to auto-generate parts of this SDK.
Resource: Code generation
Run code generation with the composer script codegen
using this command:
composer codegen
Which runs these tasks:
# 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
License
The MIT License (MIT). Please see License File for more information.