feat: Version 3.5.2 - Configuration Stripe et gestion des immeubles
- Configuration complète Stripe pour les 3 environnements (DEV/REC/PROD) * DEV: Clés TEST Pierre (mode test) * REC: Clés TEST Client (mode test) * PROD: Clés LIVE Client (mode live) - Ajout de la gestion des bases de données immeubles/bâtiments * Configuration buildings_database pour DEV/REC/PROD * Service BuildingService pour enrichissement des adresses - Optimisations pages et améliorations ergonomie - Mises à jour des dépendances Composer - Nettoyage des fichiers obsolètes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ using the options ``SIMULATION_STRICT`` or ``SIMULATION_LAX`` in the
|
||||
|
||||
In the ``SIMULATION_STRICT`` mode, ``ZipStream`` will not allow to calculate the
|
||||
size based on reading the whole file. ``SIMULATION_LAX`` will read the whole
|
||||
file if neccessary.
|
||||
file if necessary.
|
||||
|
||||
``SIMULATION_STRICT`` is therefore useful to make sure that the size can be
|
||||
calculated efficiently.
|
||||
|
||||
@@ -12,11 +12,14 @@ Here is the full list of options available to you. You can also have a look at
|
||||
|
||||
$zip = new ZipStream(
|
||||
// Define output stream
|
||||
// (argument is eiter a resource or implementing
|
||||
// (argument is either a resource or implementing
|
||||
// `Psr\Http\Message\StreamInterface`)
|
||||
//
|
||||
// Setup with `psr/http-message` & `guzzlehttp/psr7` dependencies
|
||||
// required when using `Psr\Http\Message\StreamInterface`.
|
||||
//
|
||||
// Can also use CallbackStreamWrapper for custom output handling:
|
||||
// outputStream: CallbackStreamWrapper::open(function($data) { /* handle data */ }),
|
||||
outputStream: $filePointer,
|
||||
|
||||
// Set the deflate level (default is 6; use -1 to disable it)
|
||||
|
||||
@@ -37,3 +37,77 @@ Stream to S3 Bucket
|
||||
$zip->finish();
|
||||
|
||||
fclose($zipFile);
|
||||
|
||||
Stream to Callback Function
|
||||
---------------------------
|
||||
|
||||
The CallbackStreamWrapper allows you to stream ZIP data to a custom callback function,
|
||||
enabling flexible output handling such as streaming to multiple destinations,
|
||||
progress tracking, or data transformation.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use ZipStream\ZipStream;
|
||||
use ZipStream\Stream\CallbackStreamWrapper;
|
||||
|
||||
// Example 1: Stream to multiple destinations with proper file handling
|
||||
$backupFile = fopen('backup.zip', 'wb');
|
||||
$logFile = fopen('transfer.log', 'ab');
|
||||
|
||||
$zip = new ZipStream(
|
||||
outputStream: CallbackStreamWrapper::open(function (string $data) use ($backupFile, $logFile) {
|
||||
// Send to browser
|
||||
echo $data;
|
||||
|
||||
// Save to file efficiently
|
||||
fwrite($backupFile, $data);
|
||||
|
||||
// Log transfer progress
|
||||
fwrite($logFile, "Transferred " . strlen($data) . " bytes\n");
|
||||
}),
|
||||
sendHttpHeaders: false,
|
||||
);
|
||||
|
||||
$zip->addFile('hello.txt', 'Hello World!');
|
||||
$zip->finish();
|
||||
|
||||
// Clean up resources
|
||||
fclose($backupFile);
|
||||
fclose($logFile);
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// Example 2: Progress tracking
|
||||
$totalBytes = 0;
|
||||
$zip = new ZipStream(
|
||||
outputStream: CallbackStreamWrapper::open(function (string $data) use (&$totalBytes) {
|
||||
$totalBytes += strlen($data);
|
||||
reportProgress($totalBytes); // Report progress to your tracking system
|
||||
|
||||
// Your actual output handling
|
||||
echo $data;
|
||||
}),
|
||||
sendHttpHeaders: false,
|
||||
);
|
||||
|
||||
$zip->addFile('large_file.txt', str_repeat('A', 10000));
|
||||
$zip->finish();
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// Example 3: Data transformation using PHP stream filters
|
||||
// For data transformations, prefer PHP's built-in stream filters
|
||||
$outputStream = fopen('php://output', 'w');
|
||||
stream_filter_append($outputStream, 'convert.base64-encode');
|
||||
|
||||
$zip = new ZipStream(
|
||||
outputStream: $outputStream,
|
||||
sendHttpHeaders: false,
|
||||
);
|
||||
|
||||
$zip->addFile('secret.txt', 'Confidential data');
|
||||
$zip->finish();
|
||||
fclose($outputStream);
|
||||
|
||||
.. note::
|
||||
For data transformations, PHP's built-in stream filters are preferred over callback transformations. Stream filters operate at the stream level and maintain data integrity. You can register custom filters using ``stream_filter_register()`` for specialized transformations.
|
||||
|
||||
@@ -39,7 +39,7 @@ as well:
|
||||
If ``composer install`` yields the following error, your installation is missing
|
||||
the `mbstring extension <https://www.php.net/manual/en/book.mbstring.php>`_,
|
||||
either `install it <https://www.php.net/manual/en/mbstring.installation.php>`_
|
||||
or run the follwoing command:
|
||||
or run the following command:
|
||||
|
||||
.. code-block::
|
||||
Your requirements could not be resolved to an installable set of packages.
|
||||
@@ -120,7 +120,7 @@ It is recommended to extract with another tool like
|
||||
`7-zip <https://www.7-zip.org/>`_.
|
||||
See `#146 <https://github.com/maennchen/ZipStream-PHP/issues/146>`_.
|
||||
|
||||
It is the responsability of the client code to make sure that files are not
|
||||
It is the responsibility of the client code to make sure that files are not
|
||||
saved with the same path, as it is not possible for the library to figure it out
|
||||
while streaming a zip.
|
||||
See `#154 <https://github.com/maennchen/ZipStream-PHP/issues/154>`_.
|
||||
|
||||
Reference in New Issue
Block a user