PHP code example of proteins / response

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

    

proteins / response example snippets


use Proteins\Response;

Response::add('Hello world!');

Response::send();

Response::header('Authorization','Bearer mF_9.B5f-4.1JqM');

$response_headers = Response::headers();

$response_body = Response::body();

Response::body($new_body);

Response::status(401);

Response::error(401, "User not authorized");

Response::download("export.csv");

Response::download([
	"filename" 	=> "export.csv",
	"charset" 	=> "utf-8",
	"mime" 		=> "text/csv",
	"body" 		=> CSV::fromSQL("SELECT * FROM users")
]);

Response::push('/assets/css/main.css');
Response::push('/assets/js/main.js');

Response::push('/assets/css/main.css','style');
Response::push('/assets/js/main.js','script');

Response::push([
  '/assets/css/main.css',
  '/assets/js/main.js',
]);

Response::push([
  'style'  => '/assets/css/main.css',
  'script' => [
    '/assets/js/vendors.js',
    '/assets/js/main.js',
  ],
]);