Download the PHP package robuust/craft-hubspot-forms without Composer

On this page you can find all versions of the php package robuust/craft-hubspot-forms. 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 craft-hubspot-forms

HubSpot API Forms plugin for Craft

Plugin that allows you to render HubSpot forms from their API

Requirements

This plugin requires Craft CMS 5.0.0 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

    cd /path/to/project
  2. Then tell Composer to load the plugin:

    composer require robuust/craft-hubspot-forms
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for HubSpot API Forms.

Config

Create a file called hubspot-api-forms.php in you Craft config folder with the following contents:

Usage

Create a new "HubSpot Form" field and add it to the desired element's field layout. Now when editing such element you can select a HubSpot form to use.

In your front-end templates you can render this as a form.

Server-side submission validation

Rendering a form does not protect its submissions. The plugin's field retrieves a definition for rendering; it does not intercept forms posted directly to HubSpot or through another module's proxy. Use the plugin's form service at your Craft submission boundary:

Pass flat v2 form parameters as strings. Remove Craft's action, CSRF parameter, and proxy target before calling the service. hs_context and other non-field parameters are preserved; they are not validated by this service. Portal and form selection, transport/context validation and spam assessment belong to the caller.

submit() calls validateSubmission() before making its POST to HubSpot's fixed v2 submission host. Validation always fetches the current /marketing/v3/forms/{formId} definition using the configured access token. It does not trust a client-supplied definition or the indefinite rendering cache. Definition/API/configuration errors propagate and must stop forwarding; do not catch them and continue with the original body.

Validation covers:

This initial service supports ordinary default_group forms. Dependent fields, progressive groups, file uploads and unknown field types raise InvalidConfigException and are not forwarded. Conditional visibility, progressive profiling, file handling and consent policy require an integration designed for those form definitions. The service does not add a public controller or change existing form actions. The supported types follow the HubSpot v3 field models; both date formats follow HubSpot's Forms API announcement.

Custom proxy integration

A custom proxy that submits directly to HubSpot must explicitly call this service to enable validation. Installing the plugin does not intercept those requests. To integrate it with an existing proxy:

  1. Resolve the submitted target to a server-approved portal/form pair (for example, an allowlist of exact targets generated from the site's configured forms).
  2. After removing routing/CSRF/target parameters, call the plugin before any spam assessment:

  3. Run any existing spam assessment on the returned body, then forward that same body with your HTTP client to the approved target. Do not call submit() as well: the body has already been validated. API/configuration failures must stop the request rather than become permission to forward.
  4. Preserve your proxy's response handling. The controller's 400 validation response can use your form's error UI; field-specific errors are also available on the exception if the integration needs them.

Example

Here is an example that renders a HubSpot form. You can change and style this example any way you want. It posts directly to HubSpot and therefore bypasses the server-side service above. To use server-side validation, post to your Craft controller with csrfInput() and select the configured form in that controller.


All versions of craft-hubspot-forms with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
craftcms/cms Version ^5.0
hubspot/api-client Version ^11.3
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 robuust/craft-hubspot-forms contains the following files

Loading the files please wait ...