Download the PHP package glueful/import-export without Composer

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

Import Export Extension for Glueful

Overview

Import Export is a general import/export engine for Glueful applications. It owns the machinery every bulk data flow needs -- jobs, deterministic batches, queue dispatch, claiming, progress roll-up, row errors, reports, retries, and management APIs -- while knowing nothing about what the records mean.

Domain meaning lives in adapters. Your app (a CMS, a commerce back office, a CRM) implements ImporterInterface / ExporterInterface for its own record types and registers them through service tags. The engine never parses your content model, never validates your prices, and never decides what a "post" is; it just runs the job safely.

Features

Installation

Install via Composer:

Composer discovers packages of type glueful-extension, but installing does not auto-enable them. Enable the provider and run migrations:

Local Development Installation

Register the extension as a Composer path repository in your app's composer.json, then require and enable it:

Verify Installation

Post-install checklist:

Writing an Adapter

Importer Contract

Implement Glueful\Extensions\ImportExport\Contracts\ImporterInterface:

Method Responsibility
key(): string Stable machine key (used in API calls and job rows).
label(): string Human-readable label for adapter listings.
supports(ImportSource $source): bool Whether this source (disk, path, MIME type, metadata) can be imported.
plan(ImportSource $source, ImportOptions $options): ImportPlan Inspect the source and return totalRecords, a deterministic list of ImportBatch windows (uuid, sequence, offset, limit), and whether the adapter is retryable.
process(ImportBatch $batch, ImportContext $context): ImportBatchResult Handle one claimed batch window and return processed/failed counts plus row errors.

Exporter Contract

Implement Glueful\Extensions\ImportExport\Contracts\ExporterInterface:

Method Responsibility
key(): string / label(): string As above.
plan(ExportOptions $options): ExportPlan Return totalRecords, deterministic ExportBatch windows, and retryability. format, filters, and options are delivered here.
process(ExportBatch $batch, ExportContext $context): ExportBatchResult Handle one claimed batch and return counts, errors, and optionally a resultPath (recorded as a result file on the job).

What process() Actually Receives

Be aware of what survives the queue round-trip. The engine persists only the batch window (uuid, sequence, offset, limit) and the job row. At process time:

Adapters that need plan-time options, filters, or formats during process() must carry them themselves (for example, encode them in a sidecar file, a domain table, or derive them from the source again).

Registration via Service Tags

Tag your adapter services with import_export.importer or import_export.exporter in your extension's (or app provider's) services() definition. Both tag forms work:

Adapter keys must be unique; the registry rejects duplicate keys at construction.

Adapters should not create jobs, mutate import_export_* tables directly, dispatch queue jobs, or decide global retry behavior -- that is the engine's job.

Retryability and Idempotency Contract

Retry is explicit and engine-owned. To opt in, implement Glueful\Extensions\ImportExport\Contracts\RetryableAdapterInterface and return true from retryable().

The contract: retry re-delivers the whole batch window. When a job is retried, every failed batch is reset to pending and pushed again in full -- including records that may already have been applied before the batch failed midway. Retryable adapters therefore MUST apply records idempotently: upsert by a stable source key (an external id, a slug, a checksum), or detect and skip already-applied records.

If your adapter cannot make process() idempotent per batch, do not implement the retry capability; the engine will refuse explicit retries for it.

A Lemma Adapter Sketch

As a motivating example, a CMS like Lemma would ship its own adapter set in its own package -- the engine stays domain-blind:

Those adapters, their keys, and their mappings belong to Lemma; this package only runs them.

Job Lifecycle

Statuses

pending -> planning -> queued -> running -> completed | failed | cancelled, with failed -> queued reachable only through explicit retry. Transitions are validated; invalid transitions are rejected (HTTP 422 on cancel).

Creation

createImport() verifies supports(), calls the adapter's plan(), persists the job (+ a source file row for imports), persists one batch row per planned batch, pushes one queue job per batch onto the configured queue, and dispatches ImportExportJobCreated. Imports default to dry_run mode; exports always run in commit mode.

Dry-Run vs Commit

The import mode is persisted on the job and delivered to process() through ImportContext::mode. In dry_run, adapters must validate and count but not write domain data; row errors are recorded either way, so a dry run doubles as a validation report.

Batch Claiming and Stale-Lock Reclaim

A worker claims a batch with a single conditional UPDATE that flips it to running, always sets a fresh locked_at, increments attempts, and stamps started_at. The claim succeeds for a pending batch, or for a running batch whose locked_at is older than the stale window (currently fixed at 15 minutes) -- so a batch orphaned by a crashed worker is reclaimed instead of stuck. Losing claimants exit cleanly.

Never-Throw Queue Jobs

ProcessImportBatchJob / ProcessExportBatchJob run with getMaxAttempts() = 1 and shouldRetry() = false, and handle() never lets an exception escape. An adapter exception inside a claimed batch marks the batch failed, records an adapter_exception row error, dispatches ImportExportBatchFailed, rolls the job up, and returns cleanly. Queue auto-redelivery is deliberately not the retry policy, because re-delivering a half-applied batch to a non-idempotent adapter would duplicate records.

Roll-Up and Completion

After each batch finishes, the engine sums batch counters into the job. When no batch is left pending/running, the job transitions to completed (no failed records) or failed, dispatching ImportExportJobCompleted / ImportExportJobFailed.

Cancellation

Cancel transitions the job to cancelled and dispatches ImportExportJobCancelled. Cancellation is observed at batch boundaries: queued batches check job status before claiming and exit; a batch already in flight finishes its current run.

Retry

POST /jobs/{uuid}/retry, import-export:retry, or RetryService::retry() resets each failed batch (pending, locks and timestamps cleared) and re-queues it, then moves the job back to queued. Retry is refused unless the adapter implements RetryableAdapterInterface and reports retryable() === true.

HTTP API

Routes are mounted under /import-export when routes_enabled is true. All routes require auth plus the listed permission (fail-closed).

Method Path Permission Description
GET /import-export/adapters import_export.view List registered importer/exporter adapters.
POST /import-export/imports import_export.run_import Create + queue an import job (adapter, relative path required; disk, mime_type, metadata, mode, batch_size, options).
POST /import-export/exports import_export.run_export Create + queue an export job (adapter required; format, batch_size, filters, options).
GET /import-export/jobs import_export.view List jobs; query params type, status, limit (1-200, default 50).
GET /import-export/jobs/{uuid} import_export.view One job with its batches.
GET /import-export/jobs/{uuid}/errors import_export.view Stored row errors for a job.
GET /import-export/jobs/{uuid}/report import_export.view Latest report (built on demand if absent).
POST /import-export/jobs/{uuid}/cancel import_export.cancel Cancel a job (422 on invalid transition).
POST /import-export/jobs/{uuid}/retry import_export.retry Re-queue failed batches of a retryable job.
POST /import-export/jobs/{uuid}/failed-records/export import_export.export_failed_records Write failed-record errors to a managed private file (format=ndjson|csv).

CLI

Command Description
import:run --adapter= --path= [--disk=uploads] [--mime-type=] [--mode=dry_run] [--batch-size=500] [--actor=] [--options=JSON] Create and queue an import job.
export:run --adapter= [--format=ndjson] [--batch-size=500] [--actor=] [--filters=JSON] [--options=JSON] Create and queue an export job.
import:list [--status=] [--limit=50] List import jobs.
export:list [--status=] [--limit=50] List export jobs.
import-export:status <job-uuid> Show job status and batches.
import-export:retry <job-uuid> Retry failed batches (retryable adapters only).
import-export:cancel <job-uuid> Cancel a job.
import-export:cleanup [--days=30] Delete terminal jobs older than the cutoff, with their result and tmp files.

Service API

Use ImportExportService directly when another service owns the workflow:

Exports use createExport() with ExportOptions.

Permissions

The HTTP API is guarded by the extension-owned import_export_permission route middleware, which resolves the framework PermissionManager and calls can() with the import_export resource. The guard fails closed: no authenticated user, no available permission manager, or a denial all return HTTP 403.

Job read/operate endpoints are additionally owner-scoped by created_by. A user can list, inspect, cancel, retry, report, or export failed records only for jobs they created. Grant import_export.manage_all to trusted operators who need cross-user job access.

Permission slugs (registered in the framework permission catalog):

Events

All events extend the framework BaseEvent. Payload fields in parentheses.

Event Dispatched when
ImportExportJobCreated (jobUuid, type, adapter) A job and its batches are queued.
ImportExportJobStarted (jobUuid, type, adapter) The first batch claim moves the job to running.
ImportExportBatchCompleted (jobUuid, batchUuid, type, adapter) A batch finishes with zero failed records.
ImportExportBatchFailed (jobUuid, batchUuid, type, adapter, reason) A batch finishes with failed records, or an adapter exception fails a claimed batch.
ImportExportJobCompleted (jobUuid, type, adapter) All batches finished with no failures.
ImportExportJobFailed (jobUuid, type, adapter, reason) All batches finished and at least one failed.
ImportExportJobCancelled (jobUuid, type, adapter) A job is cancelled via HTTP or CLI.

Reports, Failed Records, and Retention

Configuration

Configuration is loaded from config/import_export.php and merged under the import_export key.

Several keys are reserved: they are declared (and their defaults match today's hardcoded runtime values) but are not yet read by the runtime paths, so changing them currently has no effect.

Key Default Status Purpose
enabled true Reserved Extension-level enable flag (not currently consulted).
routes_enabled true Wired Set to false for service/CLI-only installs.
queue import-export Wired Queue name used for batch jobs.
source_disk uploads Wired HTTP/CLI default source disk.
source_roots [] Wired Optional disk-to-local-root map for import sources; otherwise each disk resolves under <base>/<disk>.
result_disk local Wired Disk recorded for export result files. It must name a disk in the app's storage.disks: retention deletes results through it, and an app reads them back through it.
private_path null Wired Private local root for HTTP-managed failed-record exports; defaults to <base>/import-export.
tmp_disk / tmp_path local / import-export/tmp Reserved Retention deletes tmp rows through the disk each row names.
batch_size 500 Reserved Creation paths default to 500; override per job via batch_size / --batch-size.
max_batches_per_job 10000 Wired Maximum planned batches an adapter may return for one import/export job.
max_file_size 52428800 Wired Import source size limit enforced from the resolved local file size; request metadata is ignored.
retention_days 30 Wired Default cutoff age for import-export:cleanup when --days is omitted.
error_cap_per_severity 1000 Reserved Runtime cap is currently fixed at 1000 per severity.
stale_lock_minutes 15 Reserved Stale-lock reclaim window is currently fixed at 15 minutes.

Security

Import Source Paths

HTTP and CLI import creation accepts a relative source path, never an absolute local path or stream wrapper. The service resolves the path under the configured disk root (import_export.source_roots[disk], falling back to <base>/<disk>), rejects traversal, requires the resolved file to exist and be readable, and enforces max_file_size from the filesystem. Caller-supplied metadata.size_bytes is ignored for size enforcement.

Archive Safety (ZIP-Slip)

ZIP bundle extraction routes every entry name through PathGuard, which rejects:

After normalization, a realpath containment check verifies the resolved target directory is still under the extraction root. Extraction also rejects archives with more than 1000 files, any entry larger than 50 MiB, or more than 100 MiB total uncompressed data by default. Hostile archives are covered by tests.

Permission Gating

Every HTTP route runs the fail-closed permission middleware described above; there is no unauthenticated or ungated route in this extension.

Adapter Trust Boundary

Adapters run inside the application process. They should validate source structure, enforce domain permissions before writing records, and avoid shelling out to user-controlled paths. The engine records errors and progress, but it does not validate domain-specific fields, content models, prices, users, or publishing rules.

Error Data

Stored row errors may contain excerpts or identifiers from imported data. Adapters should avoid putting secrets, access tokens, or full sensitive records into error contexts.

Requirements

License

MIT -- licensed consistently with the Glueful framework.

Support

For issues, feature requests, or questions, please create an issue in the repository.


All versions of import-export with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 glueful/import-export contains the following files

Loading the files please wait ...