PHP code example of soflomo / common

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

    

soflomo / common example snippets


// Remove the book with id 123

if ($this->accept('application/json')) {
    return new JsonModel(array(
        'status' => 'success',
        'book'   => array(
            'id' => 123
        )
    ));
}

return $this->redirect()->toRoute('books');

return $this->attachment()
            ->fromFile('data/invoice/123.pdf', 'Invoice 123.pdf', 'application/pdf');

 echo $this->headLink()
                ->appendStylesheet($this->basePath() . 'css/style.css?' . $this->version());