PHP code example of mrjulio / rapture-helper

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

    

mrjulio / rapture-helper example snippets


# Assets
$assets = new Assets();
$assets->add(['styles' => 'css/main.css', 'script' => ['js/jquery.js', 'js/main.js']]);
$assets->renderCss();
// <link rel="stylesheet" type="text/css" href="/assets/css/main.css" />
$assets->renderJs();
// <script type="text/javascript" src="/assets/js/jquery.js"></script>
// <script type="text/javascript" src="/assets/js/main.js"></script>

# Time
$t = Time::now();
// getters
$t->getYear(); 			// .. $t->getSecond()
$t->getDayOfWeek(); 	// 1=Monday...7=Sunday
$t->getDayOfYear(); 	// 0 through 365
$t->getWeekOfYear();	// ISO-8601 week number of year, weeks starting on Monday
$t->getDaysInMonth();	// 28..31
$t->getQuarter();		// 1..4
// checks
$t->isWeekend();
$t->isWeekday();
$t->isToday();
$t->isYesterday();
$t->isTomorrow();
$t->isNextWeek();
$t->isLastMonth(); 	
$t->isCurrentYear();	//etc..
// modifiers start with 'go'
$t = Time::go()->goBack('1 day')->goToNext(Time::MONDAY)->goToStartOf(Time::DAY);
// format
$t->toDate(); // Y-m-d
$t->toTime(); // H:i:s
$t->toDateTime(): // Y-m-d H:i:s

# Strings
$enc  = Strings::encrypt('secret', 'secret-key');	// not for production
$dec  = Strings::decrypt($enc, 'secret-key');
$slug = Strings::sluggify('Hello world!'); // hello-world