PHP code example of elefant / app-products

1. Go to this page and download the library: Download elefant/app-products 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/ */

    

elefant / app-products example snippets


 // apps/myapp/lib/Callbacks.php

namespace myapp;

use User;

class Callbacks {
	/**
	 * If user is logged in, allow invoice.
	 */
	public static function allow_invoice () {
		return User::is_valid ();
	}
	
	/**
	 * Give everyone 10% off.
	 */
	public static function discount () {
		return User::is_valid () ? 10 : 0;
	}
}