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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user