Download the PHP package heano/basin-php without Composer

On this page you can find all versions of the php package heano/basin-php. 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 basin-php

basin-php

A small, framework-agnostic PHP client for the Basin forms API.

It isn't an official Basin package. It's the API client from Basin for Craft, with the Craft parts taken out. The plan is for that plugin to depend on this package.

Installation

You also need a PSR-18 client and PSR-17 factories. If you don't have one already, Guzzle provides both:

Getting started

Create an API key in your Basin account and keep it in an environment variable rather than in code.

Timeouts, proxies and retries belong to the HTTP client, so set them there. A fifth argument, baseUrl, defaults to https://usebasin.com/api/v1/; change it only to point at a proxy or a mock server.

Usage

Projects and forms

updateForm() only changes the fields you pass. Basin ignores field names it doesn't know, without an error, so check the spelling against Basin's API docs.

Creating and deleting forms

Without notification_emails, a new form's notifications go to the Basin account owner. Any other address has to confirm by email before it gets notifications: until then it's listed in notification_emails_pending and the form emails nobody else.

Editing a form's settings

getForm() leaves out email settings (see below). To build a settings editor, use getFormSettings(), which keeps them:

The result contains people's email addresses, so don't cache or log it.

Some settings return 200 but aren't saved by Basin's API, so they need changing in Basin itself: allowed_domains, content_blacklist, valid_email_filter and block_burner_emails (checked November 2026).

Submissions

Unknown filters and orders throw an InvalidArgumentException before anything is sent, because Basin ignores an unknown filter_by and returns everything, spam included. For the same reason, updateSubmission() only accepts read, spam and trash.

Paging

Basin returns 100 items per page. Each list method takes a page number and returns a ListPage:

Attachments

Each attachment in a submission has an id. Download it through Basin's authenticated proxy:

The PSR-7 response is returned as is, so the body can be streamed if your HTTP client supports it (Guzzle's stream option, for example). The method also accepts the last segment of an attachment's attachment_proxy_url.

Errors

Every API error extends Heano\Basin\Exception\ApiException. The exception code is the HTTP status, and messages never contain the API key.

Exception When
AuthException 401 or 403, or no API key was given
NotFoundException 404
ValidationException 422. Basin's messages are joined into the exception message, and $e->messages lists them one by one
RateLimitException 429. $e->retryAfter holds the seconds to wait, if Basin said
ApiUnavailableException 5xx, timeouts and connection failures
ApiException Anything else, including responses that aren't valid JSON

What gets removed

Basin's API returns some data in plain text that most applications never need and shouldn't store, log or show. The client removes it from every response before it reaches your code:

Endpoints covered

Method Endpoint
listProjects() GET /projects
getProject() GET /projects/{id}
listForms() GET /forms
getForm() GET /forms/{id}
getFormSettings() GET /forms/{id}
createForm() POST /forms
updateForm() PUT /forms/{id}
deleteForm() DELETE /forms/{id}
listSubmissions() GET /submissions
getSubmission() GET /submissions/{id}
updateSubmission() PATCH /submissions/{id}
deleteSubmission() DELETE /submissions/{id}
refireWebhooks() POST /submissions/{id}/refire_webhooks
downloadAttachment() GET /attachments/{id}

There's deliberately no "request anything" method. Basin's API documentation covers the rest of the API.

Development

No PHP locally? Use Docker:

The tests use mocked HTTP and never call Basin. Fixtures are scrubbed responses from a test account.

Licence

MIT. See LICENSE.


All versions of basin-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.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 heano/basin-php contains the following files

Loading the files please wait ...