Download the PHP package stechstudio/laravel-hubspot without Composer

On this page you can find all versions of the php package stechstudio/laravel-hubspot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-hubspot

HubSpot CRM SDK for Laravel

Latest Version on Packagist

Interact with HubSpot's CRM with an enjoyable, Eloquent-like developer experience.

Note Only the CRM API is currently implemented.

Installation

1) Install the package via composer:

2) Configure HubSpot

Create a private HubSpot app and give it appropriate scopes for what you want to do with this SDK.

Copy the provided access token, and add to your Laravel .env file:

Usage

Individual CRUD actions

Retrieving

You may retrieve single object records using the find method on any object class and providing the ID.

Creating

To create a new object record, use the create method and provide an array of properties.

Alternatively you can create the class first, provide properties one at a time, and then save.

Updating

Once you have retrieved or created an object, update with the update method and provide an array of properties to change.

You can also change properties individually and then save.

Deleting

This will "archive" the object in HubSpot.

Retrieving multiple objects

Fetching a collection of objects from an API is different from querying a database directly in that you will always be limited in how many items you can fetch at once. You can't ask HubSpot to return ALL your contacts if you have thousands.

This package provides three different ways of fetching these results.

Paginating

Similar to a traditional database paginated result, you can paginate through a HubSpot collection of objects. You will receive a LengthAwarePaginator just like with Eloquent, which means you can generate links in your UI just like you are used to.

By default, this paginate method will look at the page query parameter. You can customize the query parameter key by passing a string as the second argument.

Cursor iteration

You can use the cursor method to iterate over the entire collection of objects. This uses lazy collections and generators to seamlessly fetch chunks of records from the API as needed, hydrating objects when needed, and providing smooth iteration over a limitless number of objects.

Warning API rate limiting can be an obstacle when using this approach. Be careful about iterating over huge datasets very quickly, as this will still require quite a few API calls in the background.

Manually fetching chunks

Of course, you can grab collections of records with your own manual pagination or chunking logic. Use the take and after methods to specify what you want to grab, and then get.

Searching and filtering

When retrieving multiple objects, you will frequently want to filter, search, and order these results. You can use a fluent interface to build up a query before retrieving the results.

Adding filters

Use the where method to add filters to your query. You can use any of the supported operators for the second argument, see here for the full list: https://developers.hubspot.com/docs/api/crm/search#filter-search-results;

This package also provides friendly aliases for common operators =, !=, >, >=, <, <=, exists, not exists, like, and not like.

You can omit the operator argument and = will be used.

For the BETWEEN operator, provide the lower and upper bounds as a two-element tuple.

Note All filters added are grouped as "AND" filters, and applied together. Optional "OR" grouping is not yet supported.

Searching common properties

HubSpot supports searching through certain object properties very easily. See here for details:

https://developers.hubspot.com/docs/api/crm/search#search-default-searchable-properties

Specify a search parameter with the search method:

Ordering

You can order the results with any property.

The default direction is asc, you can change this to desc if needed.

Associations

HubSpot associations are handled similar to Eloquent relationships.

Dynamic properties

You can access associated objects using dynamic properties.

Association methods

If you need to add additional constraints, use the association method. You can add any of the filtering, searching, or ordering methods described above.

Eager loading association IDs

Normally, there are three HubSpot API calls to achieve the above result:

  1. Fetch the company object
  2. Retrieve all the contact IDs that are associated to this company
  3. Query for contacts that match the IDs

Now we can eliminate the second API call by eager loading the associated contact IDs. This library always eager-loads the IDs for associated companies, contacts, deals, and tickets. It does not eager-load IDs for engagements like emails and notes, since those association will tend to be much longer lists.

If you know in advance that you want to, say, retrieve the notes for a contact, you can specify this up front.

Creating associated objects

You can create new records off of the association methods.

This will create a new contact, associate it to the company, and return the new contact.

You can also associate existing objects using attach. This method accepts and ID or an object instance.

You can also detach existing objects using detach. This method accepts and ID or an object instance.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-hubspot with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^9.0|^10.0|^11.0
illuminate/http Version ^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.14.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package stechstudio/laravel-hubspot contains the following files

Loading the files please wait ....