Download the PHP package dschuppelius/php-common-toolkit without Composer
On this page you can find all versions of the php package dschuppelius/php-common-toolkit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-common-toolkit
php-common-toolkit
General-purpose PHP utility toolkit providing platform-agnostic helpers, CSV processing, and executable wrappers.
Features
- CSV Processing: Fluent builders and parsers for CSV documents with strict field typing
- Executable Wrappers: Platform-agnostic integration with external tools (ImageMagick, TIFF tools, PDF tools)
- Helper Utilities: Bank validation (IBAN, BIC, BLZ), currency formatting, string manipulation
- Enum Support: Typed enums with factory methods (CurrencyCode, CountryCode, CreditDebit, LanguageCode)
- XML Builders: Extended DOM document builder for structured XML generation
- Bundesbank Data: Auto-downloading BLZ/BIC data with expiry tracking
Architecture
Requirements
The following tools are required to successfully run dschuppelius/php-common-toolkit:
1. TIFF Tools
Required for processing and handling TIFF files.
- Windows: GnuWin32 TIFF Tools
- Debian/Ubuntu:
2. Xpdf
Required for handling PDF files.
- Windows: Xpdf Download
- Debian/Ubuntu:
3. ImageMagick
For converting and processing image files.
- Windows: ImageMagick Installer
- Debian/Ubuntu:
4. muPDF Tools
For processing PDF and XPS documents.
- Debian/Ubuntu:
5. QPDF
For advanced PDF manipulation and processing.
- Windows: QPDF Download
- Debian/Ubuntu:
Install the Toolkit into your Project
The Toolkit requires a PHP version of 8.1 or higher. The recommended way to install the SDK is through Composer.
Usage Examples
Value Objects
Immutable, exakt rechnende Value Objects unter CommonToolkit\ValueObjects —
Konstruktion über benannte Factories (of() wirft bei ungültiger Eingabe,
tryFrom()/ofNullable() liefern null). Sensible Identifikatoren (Iban,
EmailAddress, PhoneNumber, VatNumber, CreditorIdentifier,
GermanTaxId, GermanTaxNumber) implementieren bewusst weder Stringable
noch JsonSerializable — Klarwert nur über getValue(), Anzeige über
masked().
CSV Processing
Bank Validation
Bankleitzahl-/BIC-Daten (BLZ/BIC data)
Die Bundesbank-Datendateien werden mit dem Paket ausgeliefert, daher funktionieren
BankHelper::bicFromIBAN(), bicFromBLZ(), blzFromBIC() und checkBIC() out-of-the-box
auch offline – ohne vorherigen Online-Lauf:
data/blz-aktuell-txt-data.txt(Bankleitzahlen, ~2,3 MB)data/verzeichnis-der-erreichbaren-zahlungsdienstleister-data.csv(BIC-Verzeichnis)
Bei Ablauf (expiry_days in config/helper.json, Default 365 Tage) werden die Daten beim
nächsten Zugriff online von bundesbank.de aktualisiert. Schlägt die Aktualisierung fehl
(z.B. offline), wird die vorhandene – ggf. veraltete, aber gültige – ausgelieferte Datei
weiterverwendet (Stale-Fallback) statt leerer Ergebnisse.
Den Netzzugriff kannst du programmatisch steuern:
Manuelles Aktualisieren: Die beiden Dateien in data/ können jederzeit durch die
aktuellen Versionen von bundesbank.de ersetzt werden (URLs in config/helper.json unter
Bundesbank.resourceurl bzw. Zahlungsdienstleister.resourceurl). Nach dem Ersetzen
BankHelper::clearCache() aufrufen, falls der Prozess weiterläuft.
MIME-Typ ohne Datei (Byte-basiert)
File::mimeType() braucht einen Pfad. Liegt der Inhalt nur im Speicher (Upload,
HTTP-Antwort, entpackter Archiv-Eintrag), erkennt File::mimeTypeFromContent()
den Typ direkt aus den Bytes – gleiche Rückgabe-Semantik (string|false):
Erkannt wird primär über finfo::buffer(). Fehlt ext-fileinfo oder liefert es
kein belastbares Ergebnis (application/x-empty, application/octet-stream),
greift File::mimeTypeFromMagicBytes() – eine deterministische
Magic-Bytes-Tabelle (PDF, PNG, JPEG, GIF, ZIP, TIFF, GZIP, BMP, RIFF/WebP)
plus Inhaltsheuristik für XML, HTML, JSON und Text. Unbekannter Binärinhalt
ergibt application/octet-stream, ein leerer String false.
Currency Formatting
Enum Usage
Configured Helper mit CommandBuilder
Das Toolkit nutzt den CommandBuilder aus dem php-config-toolkit für elegantes Command-Building mit externen Tools:
Eigene Helper mit Executable-Konfiguration
Erstelle eigene Helper-Klassen die externe Tools nutzen:
Mit passender Konfigurationsdatei (config/image_executables.json):
Executable Configuration
Das Toolkit nutzt JSON-Konfigurationsdateien für externe Tools. Die Konfiguration ermöglicht:
- Platzhalter-Ersetzung:
[INPUT],[OUTPUT]werden zur Laufzeit ersetzt - Pfad-Validierung: Automatische Prüfung ob Tools installiert sind
- Cross-Platform: Unterschiedliche Pfade für Windows/Linux möglich
- Zentrale Verwaltung: Alle Tool-Konfigurationen an einem Ort
Verfügbare Methoden in ConfiguredHelperAbstract
| Methode | Beschreibung |
|---|---|
getConfiguredCommand($name, $params) |
Baut einen Shell-Befehl mit Platzhalter-Ersetzung |
getConfiguredJavaCommand($name, $params) |
Baut einen Java-Befehl (java -jar ...) |
isExecutableAvailable($name) |
Prüft ob ein Tool verfügbar ist |
getExecutablePath($name) |
Gibt den konfigurierten Pfad zurück |
getResolvedExecutableConfig($name, $params) |
Gibt die vollständige Tool-Konfiguration zurück |
License
This project is licensed under the MIT License.
Daniel Joerg Schuppelius 📧 [email protected]
All versions of php-common-toolkit with dependencies
ext-bcmath Version *
ext-dom Version *
ext-intl Version *
ext-zip Version *
dschuppelius/php-config-toolkit Version ^0.5
maxmind-db/reader Version ^1.11
symfony/process Version ^6.4 || ^7.0 || ^8.0