PHP code example of jn-devops / common
1. Go to this page and download the library: Download jn-devops/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/ */
jn-devops / common example snippets
documents_path(); // /resources/documents
documents_path('legal/contract.pdf'); // /resources/documents/legal/contract.pdf
formatted_age(new DateTime('1990-05-23')); // "33 years, 10 months and 3 days old"
doc_stamps(450000); // 50.0
$key = dot_shift($dot = "property.name"); // $key = "property", $dot = "name"
titleCase('juan dela cruz ii'); // Juan Dela Cruz II
array_when([1,2,3], false, fn($arr) => array_map(fn($x) => $x * 2, $arr)); // [1,2,3]
convertNumberToWords(1500.75); // ONE THOUSAND FIVE HUNDRED AND 75/100
$params = [
Input::TCP => 2500000,
Input::PERCENT_DP => 0.05,
];
expect($mortgage->getLoan()->getPrincipal()->inclusive()->compareTo($params[Assert::LOAN_AMOUNT]))->toBe(Amount::EQUAL);
UploadFile::Image->suffix(); // 'images'
UploadFile::deriveCollectionNameFromAttribute('propertyImage'); // 'property-images'
WorkArea::fromRegional(true); // WorkArea::REGION
WorkArea::default(); // WorkArea::HUC
use Homeful\Common\Classes\Input;
use Homeful\Common\Classes\Assert;
$params = [
Input::TCP => 2500000,
Input::PERCENT_DP => 0.05,
Assert::LOAN_AMOUNT => 2375000.0,
];
expect($params[Assert::LOAN_AMOUNT])->toBe(2375000.0);
documents_path('mortgage/terms.pdf');
// => /resources/documents/mortgage/terms.pdf