PHP code example of germania-kg / prices

1. Go to this page and download the library: Download germania-kg/prices library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

germania-kg / prices example snippets



use Germania\Prices\PdoPrices;

$prices_factory = new PdoPrices( $pdo );
$prices_factory = new PdoPrices( $pdo, "my_custom_table" );

// Assume article has ID 42
$article = ...

// ContainerInterface:
$complete = $prices_factory->has( 42 );

// Getting may throw NoPriceFoundException
// Interop\Container\Exception\NotFoundException)
$prices = $prices_factory->get( 42 );


// Avoid Exception using __invoke:
// Returns always array, may be empty:
$prices = $prices_factory( 42 );