### AbraFlexi Examples Overview Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.cs.md This list provides an overview of the example scripts available in the 'Examples' directory of the php-abraflexi project. Each entry includes the filename and a brief description of the functionality demonstrated. ```APIDOC Examples: - AttachmentSaveToFile.php: Uložení přílohy do souboru - AttachmentUpload.php: Nahrání přílohy - AuthSessionIdUsage.php: Ukázka autentizace AuthSessionId - AuthentizeContact.php: Autentizace kontaktu - BatchOperation.php: Použití filtru při dávkových operacích - CreateLabel.php: Práce se štítky - DryRun.php: Testovací uložení (dry-run) - DownloadInvoicePDF.php: Stažení PDF faktury - Error404.php: Práce s neexistujícími záznamy - FindOverdueInvoices.php: Najdi faktury po splatnosti - GetRecordWithRelation.php: Získání záznamu včetně dat z podevidence - GetBankAccountForCompany.php: Získání bankovního účtu k firmě z adresáře - InvoiceLockUnlock.php: Zamykání a odemykání záznamu - InvoiceCopy.php: Vytvoření daňového dokladu ze zálohy - LoginLogout.php: Přihlášení uživatele a jeho odhlášení - NajdiDanovyDokladKzalohovemu.php: Dohledání dokladu - Naskladnění.php: Naskladní produkt se sériovými čísly - NewInvoice.php: Nová faktura se splatností vypsaná jako json - ObjectChaining.php: Řetězení objektů pro více operací v jenom pořadavku - ObjectCooperation.php: Sdílení data a parametrů připojení mezi objekty - PerformingActions.php: Jak vykonávat akce nad dokladem akce. např. storno - ReadAddressColumns.php: Vrať konkrétní sloupečky - sendInvoiceByMail.php: Odeslání faktury mailem - SendReminders.php: Odeslání upomínek - SetContactAuth.php: Nastavení autentizace - TestConnection.php: Kontrola spojení ``` -------------------------------- ### Installation with Composer Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Installs the PHP AbraFlexi library using Composer. This command adds the library as a dependency to your project. ```shell composer require spojenet/flexibee ``` -------------------------------- ### Authentication Examples in PHP Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Illustrates different authentication methods for interacting with AbraFlexi, including using AuthSessionId and authenticating contacts. These examples are crucial for establishing secure connections. ```php $_GET['companyUrl'], 'authSessionId'=>$_GET['authSessionId'] ]) ``` -------------------------------- ### Configuration via Environment Variables Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Demonstrates how the library can automatically pick up configuration from environment variables if the PHP constants are not defined. This allows for flexible deployment configurations. ```php // Example: getenv('ABRAFLEXI_URL') ``` -------------------------------- ### Configuration via Class Instantiation (Credentials) Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Provides an alternative method for configuring connection details by passing them directly as an array when creating an instance of an AbraFlexi class. This method has higher priority than constants. ```php $invoicer = new \AbraFlexi\FakturaVydana(null,[ 'company' => 'Firma_s_r_o_', 'url' => 'https://abraflexi.firma.cz/', 'user' => 'rest', 'password' => '-dj3x21xaA_' ]); ``` -------------------------------- ### Instantiate FakturaVydana with Options Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Demonstrates creating an instance of the FakturaVydana class with custom constructor parameters like disabling native types and enabling debug mode. ```php new \AbraFlexi\FakturaVydana( 'code:VF2-12345', ['nativeTypes'=>false,'debug'=>true,'ignore404'=>false] ); ``` -------------------------------- ### Composer Autoload Configuration for Testing Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Shows how to configure the 'autoload-dev' section in composer.json to include paths for testing classes from the php-abraflexi library and other related packages. ```json { "autoload-dev": { "psr-4": { "Test\\": "vendor/spojenet/php-abraflexi/test/src/AbraFlexi/test/", "Test\\Ease\": "vendor/vitexsoftware/ease-core/tests/src/Ease", "Test\\AbraFlexi\": "vendor/spojenet/php-abraflexi/test/src/AbraFlexi/" } } } ``` -------------------------------- ### Instantiating AbraFlexi Classes with Credentials Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.cs.md Demonstrates how to create instances of AbraFlexi classes, such as FakturaVydana and ObjednavkaPrijata, by passing connection details directly during instantiation, overriding constant configurations. ```php $invoicer = new \AbraFlexi\FakturaVydana(null,[ 'company' => 'Firma_s_r_o_', 'url' => 'https://abraflexi.firma.cz/', 'user' => 'rest', 'password' => '-dj3x21xaA_' ]); $order = new \AbraFlexi\ObjednavkaPrijata('code:OBP0034/2019',['companyUrl'=> $_GET['companyUrl'], 'authSessionId'=>$_GET['authSessionId'] ]) ``` -------------------------------- ### Configuration via Constants Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Sets up the connection details for the AbraFlexi API using PHP constants. These constants define the API URL, login credentials, company, and optional settings like timeout and exception handling. ```php define('ABRAFLEXI_URL', 'https://abraflexi-dev.spoje.net:5434'); define('ABRAFLEXI_LOGIN', 'apiuser'); define('ABRAFLEXI_PASSWORD', 'apipass'); define('ABRAFLEXI_COMPANY', 'test_s_r_o_'); define('ABRAFLEXI_AUTHSESSID', '6QuifebMits'); // Optional define('ABRAFLEXI_TIMEOUT', 60); // Optional define('ABRAFLEXI_EXCEPTIONS', true); // Optional ``` -------------------------------- ### Invoice Creation with JSON Output in PHP Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Shows how to create a new invoice and print the due date as JSON, demonstrating flexible data formatting. ```php false,'debug'=>true,'ignore404'=>false] ); ``` -------------------------------- ### Object Chaining and Cooperation in PHP Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Illustrates advanced usage patterns like object chaining for multiple operations in a single request and sharing data/connection parameters between objects. ```php getAllFromAbraFlexi() ); ``` -------------------------------- ### Performing Actions on Documents in PHP Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Demonstrates how to perform actions on a document, such as cancellation, using the AbraFlexi library. ```php getAllFromAbraFlexi() ); ``` -------------------------------- ### Convert Evidence to Class Name Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Converts an evidence string (e.g., 'merna-jednotka') into a class-friendly format (e.g., 'MernaJednotka') by removing hyphens and capitalizing words. ```php function evidenceToClass($evidence) { return str_replace(' ', '', ucwords(str_replace('-', ' ', $evidence))); } ``` -------------------------------- ### Record Locking and Unlocking in PHP Source: https://github.com/spoje-net/php-abraflexi/blob/main/README.md Demonstrates how to lock and unlock records in AbraFlexi, ensuring data integrity during concurrent operations. ```php