Cygnite - A Modern Toolkit For Web Developers

The Elegant Way of Building Full-Featured Web Applications

Cygnite Dynamic Routing

Support

Documentation

Support

Cygnite has various global function uses internally in the framework itself. However you may use them for your application.

Displaying Formated Output

You may wish to view format output of array for debugging purpose, use show function. Simply pass first parameter as array to it.


  $results = ['one', 'two'];

  show($results);


Sometime you may wish to stop script execution after viewing the formatted output in the browser, simply pass true as second parameter.

 
    show($results, true);
 

Getting Days Difference


  $date = '2013-10-21 08:24:00';
   echo days_diff($date);

By default the function will take current date and subtract the given date from it.

Splitting String Into Array


  string_split("product-category", "-"); // By default it will split by dot(.)

Determine String Contains


  string_has("product:value", ":"); // boolean

Application Instance


  app(); 

Checking Is Console Application

Check if code is running via command line interface or web.


  isCli(); 

Escaping HTML Entities


  e($string); 

Language Translation


  trans('Hello, :user', array(':user' => $username), $locale = 'en-us');

Converting To Path

This function will replace dot or slash(/) to directory separator.


  toPath('foo.bar'); // foo/bar

Getting CSRF Validator Instance


  csrf(); // CsrfValidator instance

Getting CSRF Token

This function will return csrf token generated by CsrfValidator.


  csrf_token();

Validating CSRF Token


  validate_token($token);

Dumping Value To Debugbar

It will display values in debug bar.


  $arr = [15, TRUE, NULL, 'hello'];

  d($arr);


  d([2, 4, 6, 8], 'even numbers');
  d([1, 3, 5], 'odd numbers');

Dumping Value To Debugbar

It will display values in debug bar.



  use Cygnite\Exception\ExceptionHandler;

  logMessage("Exception log");

  logMessage("Exception log with priority",  ExceptionHandler::ERROR); // Sends an email notification


FireLogger

You may wish to log information into Fire logger.



  fire_log('Hello World');


Time benchmarking

You may wish to log information into Fire logger.



  time_bench('application-running');  

  $totalElapsed = time_bench('application-running'); //

Read more: timer

Getting Collection



  $collection = collection([1,2,3]);

  show($collection);

Generating Random String

The random function excepts two parameter, first parameter as type (normal, unique, sha1, alnum, alpha) and second parameter as length.



  \Cygnite\Helpers\Str::random('unique', 16);

  show($collection);

Follow Us On Facebook Twitter Google+ Linkedin
Released Under The MIT Public License. Copyrights @2012-2017. Powered by- Sanjoy Dey Productions.