Download the PHP package weslinkde/laravel-postgres-tools without Composer

On this page you can find all versions of the php package weslinkde/laravel-postgres-tools. 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-postgres-tools

Laravel Postgres Tools

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel package for PostgreSQL database management, optimized for large databases (16GB+). Create snapshots, restore backups, and manage databases with native PostgreSQL tools for maximum performance.

Features

Requirements

Installation

Install the package via composer:

Publish the config file:

Configuration

Don't forget to configure your snapshots disk in config/filesystems.php:

Usage

Create a Snapshot

Load a Snapshot

Delete a Snapshot

Database Management

Performance Tuning

Compression Level

The -Z flag controls compression (0-9). Higher = smaller files but slower:

Level Speed Use Case
-Z 1 Fastest Very large databases (50GB+)
-Z 3 Balanced Recommended default
-Z 9 Slowest Maximum compression needed

Parallel Restore

Snapshots are written with pg_dump --file, so the archive records data offsets and pg_restore --jobs can genuinely restore in parallel. Configure parallel jobs based on database size:

Database Size Recommended Jobs
< 1GB 1-2
1-10GB 4
10GB+ CPU cores - 2

Cloud Storage

When using remote storage (S3, etc.), snapshots are automatically streamed to a local temp directory during restore to avoid memory issues.

Client Version Mismatches

pg_restore can only read archives written by a pg_dump of the same major version or older. A PostgreSQL 14 client reading a dump from a PostgreSQL 16 server fails with:

weslink:snapshot:load verifies the archive with pg_restore --list before it drops a single table, so a mismatch aborts while the target database is still intact:

Instead of relying on whatever pg_restore happens to be first on PATH, pin the client explicitly:

This path is used for pg_dump, pg_restore, psql, createdb and dropdb alike.

Error Handling

Every command exits with a non-zero status when it fails, so scripts and CI can detect problems:

Situation Behaviour
Archive unreadable by the local client Aborts before dropping anything, exit code 1
pg_restore fails during the restore RestoreFailed with the full pg_restore stderr, exit code 1
createdb / dropdb fails DatabaseOperationFailed with the client stderr, exit code 1
psql cannot reach the server Throws instead of reporting "database does not exist"
Snapshot streamed incompletely from a remote disk Aborts before dropping anything, exit code 1
Snapshot name not found Warning, exit code 1
Schema/data dump or VACUUM ANALYZE fails Error with the client stderr, exit code 1
Listing an empty set of snapshots or databases Warning, exit code 0 — an empty result is not a failure

The exceptions live in Weslinkde\PostgresTools\Exceptions and all extend ProcessFailed, which carries the exit code, stdout and stderr of the failed command in its message.

Security

All PostgreSQL commands are built as argument arrays and executed without a shell, so table names, hosts and database names coming from configuration or command line options cannot be interpreted as shell syntax. Database names are handed to psql as variables (:'dbname') rather than interpolated into SQL. Passwords are passed via PGPASSWORD / PGPASSFILE, never on the command line.

Events

The package dispatches events during snapshot operations:

Event Description
Weslinkde\PostgresTools\Events\CreatingSnapshot Before snapshot creation
Weslinkde\PostgresTools\Events\CreatedSnapshot After snapshot creation
Weslinkde\PostgresTools\Events\LoadingSnapshot Before snapshot loading
Weslinkde\PostgresTools\Events\LoadedSnapshot After snapshot loading
Weslinkde\PostgresTools\Events\DeletingSnapshot Before snapshot deletion
Weslinkde\PostgresTools\Events\DeletedSnapshot After snapshot deletion

Example Event Listener

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of laravel-postgres-tools with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0 || ^12.0 || ^13.0
illuminate/filesystem Version ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^11.0 || ^12.0 || ^13.0
laravel/prompts Version ^0.1 || ^0.2 || ^0.3
symfony/process Version ^7.0 || ^8.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 weslinkde/laravel-postgres-tools contains the following files

Loading the files please wait ...