Download the PHP package padosoft/askmydocs-connector-base without Composer

On this page you can find all versions of the php package padosoft/askmydocs-connector-base. 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 askmydocs-connector-base

askmydocs-connector-base

Framework primitives for AskMyDocs connectors — write a Laravel package, plug it into any AskMyDocs instance.
Implement ConnectorInterface on your favourite data source (Google Drive, Notion, Confluence, a CSV bucket, an internal API, ...) and let AskMyDocs ingest it as RAG-grounded knowledge with OAuth, encrypted-at-rest credentials, retry-aware queued syncs, per-tenant isolation, and a cadence scheduler — all wired automatically by composer discovery.

CI status Packagist version Total downloads PHP version Laravel version


Table of contents

  1. Why this package
  2. What you get
  3. Architecture at a glance
  4. Installation
  5. Quick start — write your first connector in 50 lines
  6. The 10-method contract
  7. Optional: credential form interface
  8. How auto-discovery works
  9. Credential vault — encrypted, atomic, tenant-scoped
  10. Scheduler + sync job
  11. Multi-tenancy (R30 + R31)
  12. Configuration reference
  13. Testing
  14. Roadmap
  15. License

Why this package

AskMyDocs is an enterprise-grade RAG + canonical knowledge compilation system. Out of the box it ingests markdown from disk, the chat UI, an HTTP API, and a Git-driven workflow.

But the knowledge people actually want to query lives in Google Drive, Notion, Confluence, Jira, OneDrive, Evernote, Fabric, Slack, Salesforce, HubSpot, a private S3 bucket, a custom CRM — anywhere except markdown-on-disk.

This package is the smallest possible surface for shipping a new connector:

Write the connector. Ship the package. Composer-require it from any AskMyDocs install. Done.

What you get

Surface Class What it does
Contract ConnectorInterface 10 methods every connector implements
Base BaseConnector OAuth state-token CSRF, refresh helper, tenant lookup
Registry ConnectorRegistry Boot-time R23 validation + composer-extra auto-discovery
Vault Auth\OAuthCredentialVault AES-encrypted tokens, atomic setExtraKey (R21), tenant scope
Scheduler Scheduling\SyncScheduler Cadence walker, chunkById(100), active-only filter
Job ConnectorSyncJob $tries=3, exponential backoff, tenant-restore safety
Models ConnectorInstallation + ConnectorCredential BelongsToTenant trait, cascade delete
Migrations connector_installations + connector_credentials Auto-loaded by the service provider
Exceptions ConnectorAuthException, ConnectorApiException, ConnectorPaginationLimitException, RegistryConfigurationException Distinct failure semantics: auth = no retry, api = retry, paginator-limit = partial success
DTOs SyncResult, HealthStatus Immutable outcomes
Tenancy Support\TenantContext + Models\Concerns\BelongsToTenant Request-scoped tenant, auto-fill on creating
Credential form (optional) Contracts\SupportsCredentialForm + Support\CredentialField Opt-in interface for credential-based connectors (IMAP, API key, …) — host renders a native admin form instead of OAuth redirect

Architecture at a glance

Installation

The service provider is auto-discovered (Laravel package discovery). The package ships its own migrations — run them:

Want to copy the migrations into your host app's database/migrations/ (e.g. to tweak tenant_id length)? Publish them:

Same for the config:

Wire the scheduler from your host app's bootstrap/app.php:

That's it. Connector packages installed via composer are now auto-discovered and synced on cadence.

Quick start — write your first connector in 50 lines

Create a new Laravel package. Add padosoft/askmydocs-connector-base to its require. Declare your connector class FQCN under extra.askmydocs.connectors:

Implement the connector:

composer require you/askmydocs-connector-myapi in any AskMyDocs install — the registry auto-discovers it, the scheduler starts dispatching it on cadence, the admin UI lists it in the available-connectors picker.

The 10-method contract

Every connector implements 10 methods (3 metadata + 1 scope + 2 OAuth + 2 sync + 1 disconnect + 1 health):

Method Purpose Throws
key(): string Stable kebab-case identifier (google-drive, notion). Used as URL slug + connector_installations.connector_name.
displayName(): string Human label shown in the admin UI.
iconUrl(): string Connector logo URL. BaseConnector provides a default that resolves public/connectors/{key}.svg via asset().
oauthScopes(): array List of scope strings the provider requires. Surfaced to the user in the install confirmation dialog.
initiateOAuth(int): string Build the provider's authorization URL. Use $this->issueOAuthState() for CSRF. ConnectorAuthException
handleOAuthCallback(int, Request): void Exchange auth code -> tokens, verify state, persist via $this->vault->setCredentials(). ConnectorAuthException on any failure
syncFull(int): SyncResult Full discovery + ingestion. Long-running. Called at install + operator re-sync. propagates upstream errors
syncIncremental(int, ?Carbon): SyncResult Delta since $since. Falls back to syncFull when $since === null. Called by the cadence scheduler. ConnectorApiException for transient (retry), ConnectorAuthException for credentials (no retry)
disconnect(int): void Clear credentials, optionally revoke at provider. swallow / log; framework deletes installation row after
health(int): HealthStatus Fast (under 2s) side-effect-free probe. returns HealthStatus::errored(...) instead of throwing

Optional: credential form interface

For connectors that use credentials instead of OAuth (IMAP, SMTP, API-key-based providers, ...), implement the optional SupportsCredentialForm interface alongside ConnectorInterface.

The host detects the interface via instanceof at install time and renders a native admin form. Each field is described by a CredentialField value object — call toArray() on each to produce the JSON shape the host expects.

CredentialField properties:

Property Type Description
name string Form-data key (e.g. 'host')
label string Human-readable UI label
type string text | number | password | select | checkbox
target string connection | configconfig_json; auth_mode; provider; secret → vault
required bool Whether the field must be filled
secret bool Masked in UI; routed to vault, never config_json
default mixed Pre-filled value
options array<string,string> For select: ['value' => 'Label']
showIf array{field:string,equals:string}\|null Conditional display rule
help string\|null Helper text rendered below the field
group string\|null Optional UI section heading

Connectors that use only the standard OAuth redirect do not implement this interface — it is entirely opt-in and backward compatible.

How auto-discovery works

ConnectorRegistry merges two sources at boot:

  1. config/connectors.php::built_in — FQCN list for connectors the host app wires by hand (rare).
  2. composer.lock packages — every entry whose extra.askmydocs.connectors is a non-empty array of FQCNs.

Each FQCN is resolved through the container and instanceof-checked against ConnectorInterface (R23). Failure modes:

All boot-time. No silent fallthrough to a confusing "undefined method" later.

Credential vault — encrypted, atomic, tenant-scoped

OAuthCredentialVault is the single chokepoint for every connector's tokens:

A read-modify-write without the lock loses siblings under contention. The package was extracted from AskMyDocs precisely after this race was caught + fixed in production.

Scheduler + sync job

SyncScheduler::registerSchedules($schedule) registers one everyMinute() closure. The closure walks every STATUS_ACTIVE installation in chunkById(100) and dispatches ConnectorSyncJob for each that's due (i.e. last_sync_at + cadenceMinutes <= now()).

ConnectorSyncJob:

Multi-tenancy (R30 + R31)

Every model uses the BelongsToTenant trait:

Host applications with their own TenantContext rebind via a container alias — both surfaces observe the same active tenant.

Configuration reference

Testing

Tests use Orchestra Testbench with SQLite in-memory. The default suite has zero external dependencies — every Laravel facade is in scope, every Crypt::encryptString() call uses a per-test APP_KEY, every model uses RefreshDatabase.

For connector packages built ON TOP of this base, follow the standard padosoft testing pattern: a default tests/Unit/ suite that uses Http::fake() (zero cost, runs in CI), plus an opt-in tests/Live/ suite that hits the real provider API (skipped when the env var is missing, invoked explicitly by maintainers).

Roadmap

Community PRs welcome — open an issue first to discuss scope.

License

Apache-2.0 (c) Padosoft / Lorenzo Padovani. See LICENSE.


All versions of askmydocs-connector-base with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/queue Version ^12.0|^13.0
illuminate/console Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.0
nesbot/carbon Version ^2.0|^3.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 padosoft/askmydocs-connector-base contains the following files

Loading the files please wait ...