What's the best way to handle a open source SaaS product with managed hosted version?
I currently build a customer feedback tool with Symfony and i thinking about making it open source similar to plausible with a managed hosting version. But obviously there should be no payment and Google login in the open source version what's the best way to handling it? Should I create a Symfony bundle or create a fork of the open source version for the managed version? Just curious what do you think about how to handle this use case in Symfony.
https://redd.it/1k2z8rd
@r_php
I currently build a customer feedback tool with Symfony and i thinking about making it open source similar to plausible with a managed hosting version. But obviously there should be no payment and Google login in the open source version what's the best way to handling it? Should I create a Symfony bundle or create a fork of the open source version for the managed version? Just curious what do you think about how to handle this use case in Symfony.
https://redd.it/1k2z8rd
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
I made a tiny PHPUnit extension for PSR-7, XML/HTML and JSON assertions
Hi! I found myself often struggling with testing against server PSR-7 responses, XML and JSON documents, Frameworks like Laravel and Symfony offer useful assertions for that but it's often that a project is not using either of the frameworks or it's just not enough. So I made an extension to PHPUnit:
https://github.com/stein197/phpunit-extended
I'd be glad if someone finds its also useful or finds any issues with it
https://redd.it/1k2zy0l
@r_php
Hi! I found myself often struggling with testing against server PSR-7 responses, XML and JSON documents, Frameworks like Laravel and Symfony offer useful assertions for that but it's often that a project is not using either of the frameworks or it's just not enough. So I made an extension to PHPUnit:
https://github.com/stein197/phpunit-extended
I'd be glad if someone finds its also useful or finds any issues with it
https://redd.it/1k2zy0l
@r_php
GitHub
GitHub - stein197/phpunit-extended: Extended assertions for PHPUnit
Extended assertions for PHPUnit. Contribute to stein197/phpunit-extended development by creating an account on GitHub.
PHP named argument unpacking
Hello, I am planning to make an RFC but before that I wanted to know your opinion on it.
Currently PHP allows named arguments so we can do something like this:
function calc(int $number, int $power): int
calc(number: $number, power: $power);
But when we have a variable parameter.
function calc(int $number, int ...$power): int
It is not possible to call the function using named parameters since PHP does not know how to group variable parameters so this is my proposal:
calc(number: $number, power: { $calc_number_1, $calc_number_2, $calc_number_3 });
{ } could be used only when trying to call a function with named parameters and one of its parameters is variadic.
A simpler example to visualize would be this:
function calc(array $into, array ...$insert): array
calc(insert: { $var_1, $var_2, $var_3 }, into: $my_array);
This syntax is much clearer and easier to understand than:
calc(insert: [$var_1, $var_2, $var_3], into: $my_array);
Also, another point to take into account is that with this new syntax, you could combine "parameters by reference" with "named parameters"
For example:
function build_user(int $type, mixed &...$users) {
foreach($users as &$user) {
// Any actions
$user = new my\User(...);
}
build_user(type: $user_type, users: { $alice, $dominic, $patrick });
$alice->name('Alice');
$dominic->name('dominic');
$patrick->name('patrick');
-------------------------------------------------------------------------------
This is already an extra:
If when using named parameters together with the variadic variable, the unpacker returns as a key the name of the sent variable you could do something like this:
function extract(string $path, mixed &...$sources) {
foreach( $sources as $type => &$source) {
switch($type) {
case: 'css':
$source = new my\CSS($path);
break;
case: 'js':
$source = new my\JS($path);
default:
$source = null;
}
}
extract(path: $my_path, sources: { $css, $js });
print $css;
print $js;
Another extra:
It would also be possible to have more than one variadic parameter in a function.
function zoo(int $id, Mammals ...$mammals, ...Cetaseans $cetaceans, Birds ...$birds)
zoo(id: $id, mammals: { $elephants, $giraffes, $wolves }, cetaseans: { $belugas }, birds: { $eagles, $hummingbirds });
https://redd.it/1k37pfd
@r_php
Hello, I am planning to make an RFC but before that I wanted to know your opinion on it.
Currently PHP allows named arguments so we can do something like this:
function calc(int $number, int $power): int
calc(number: $number, power: $power);
But when we have a variable parameter.
function calc(int $number, int ...$power): int
It is not possible to call the function using named parameters since PHP does not know how to group variable parameters so this is my proposal:
calc(number: $number, power: { $calc_number_1, $calc_number_2, $calc_number_3 });
{ } could be used only when trying to call a function with named parameters and one of its parameters is variadic.
A simpler example to visualize would be this:
function calc(array $into, array ...$insert): array
calc(insert: { $var_1, $var_2, $var_3 }, into: $my_array);
This syntax is much clearer and easier to understand than:
calc(insert: [$var_1, $var_2, $var_3], into: $my_array);
Also, another point to take into account is that with this new syntax, you could combine "parameters by reference" with "named parameters"
For example:
function build_user(int $type, mixed &...$users) {
foreach($users as &$user) {
// Any actions
$user = new my\User(...);
}
build_user(type: $user_type, users: { $alice, $dominic, $patrick });
$alice->name('Alice');
$dominic->name('dominic');
$patrick->name('patrick');
-------------------------------------------------------------------------------
This is already an extra:
If when using named parameters together with the variadic variable, the unpacker returns as a key the name of the sent variable you could do something like this:
function extract(string $path, mixed &...$sources) {
foreach( $sources as $type => &$source) {
switch($type) {
case: 'css':
$source = new my\CSS($path);
break;
case: 'js':
$source = new my\JS($path);
default:
$source = null;
}
}
extract(path: $my_path, sources: { $css, $js });
print $css;
print $js;
Another extra:
It would also be possible to have more than one variadic parameter in a function.
function zoo(int $id, Mammals ...$mammals, ...Cetaseans $cetaceans, Birds ...$birds)
zoo(id: $id, mammals: { $elephants, $giraffes, $wolves }, cetaseans: { $belugas }, birds: { $eagles, $hummingbirds });
https://redd.it/1k37pfd
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
How much overhead does DDEV take when the applications are in operation?
When the web, database and other service related containers setup for docker by DDEV are in operation do the requests have to be proxied through some DDEV services running in the background?
I take it that with some DDEV services listening on port 80 and 443 on the Docker host there may be some overhead, but does that entail some real computational work?
I just want to ascertain that other than issuing the
https://redd.it/1k37i3x
@r_php
When the web, database and other service related containers setup for docker by DDEV are in operation do the requests have to be proxied through some DDEV services running in the background?
I take it that with some DDEV services listening on port 80 and 443 on the Docker host there may be some overhead, but does that entail some real computational work?
I just want to ascertain that other than issuing the
ddev commands to the docker containers DDEV doesn't incur much overhead, and that any overhead will be down to the containers themselves.https://redd.it/1k37i3x
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
A Week of Symfony #955 (April 14–20, 2025)
https://symfony.com/blog/a-week-of-symfony-955-april-14-20-2025?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1k3hnfz
@r_php
https://symfony.com/blog/a-week-of-symfony-955-april-14-20-2025?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1k3hnfz
@r_php
Symfony
A Week of Symfony #955 (April 14–20, 2025) (Symfony Blog)
This week, the upcoming Symfony 7.3 version improved the AsAlias attribute by adding a new argument, introduced Clock support for UriSigner, and refined the return type of the `ContainerInterface::get…
One month into PHP and I feel like I’m getting nowhere. Is this normal ?
I’ve just started learning PHP from scratch it’s been almost a month now. But honestly, I’m finding it super boring. Feels like I’m not getting anywhere. I study, but nothing sticks… I keep forgetting everything. Does this happen to everyone, or is it just me?
https://redd.it/1k3j7m6
@r_php
I’ve just started learning PHP from scratch it’s been almost a month now. But honestly, I’m finding it super boring. Feels like I’m not getting anywhere. I study, but nothing sticks… I keep forgetting everything. Does this happen to everyone, or is it just me?
https://redd.it/1k3j7m6
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Weekly /r/Laravel Help Thread
Ask your Laravel help questions here. To improve your chances of getting an answer from the community, here are some tips:
What steps have you taken so far?
What have you tried from the documentation?
Did you provide any error messages you are getting?
Are you able to provide instructions to replicate the issue?
Did you provide a code example?
Please don't post a screenshot of your code. Use the code block in the Reddit text editor and ensure it's formatted correctly.
For more immediate support, you can ask in the official Laravel Discord.
Thanks and welcome to the r/Laravel community!
https://redd.it/1k3r4oz
@r_php
Ask your Laravel help questions here. To improve your chances of getting an answer from the community, here are some tips:
What steps have you taken so far?
What have you tried from the documentation?
Did you provide any error messages you are getting?
Are you able to provide instructions to replicate the issue?
Did you provide a code example?
Please don't post a screenshot of your code. Use the code block in the Reddit text editor and ensure it's formatted correctly.
For more immediate support, you can ask in the official Laravel Discord.
Thanks and welcome to the r/Laravel community!
https://redd.it/1k3r4oz
@r_php
Laravel
Installation - Laravel 12.x - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
[Symfony Bundle] Entity Kit Bundle
https://github.com/abdellahrk/EntityKitBundle
https://redd.it/1k3rvea
@r_php
https://github.com/abdellahrk/EntityKitBundle
https://redd.it/1k3rvea
@r_php
GitHub
GitHub - abdellahrk/EntityKitBundle: Entity Bundle Kit is a modern Symfony bundle that gives your Doctrine entities superpowers…
Entity Bundle Kit is a modern Symfony bundle that gives your Doctrine entities superpowers with minimal boilerplate. It provides a growing collection of prebuilt behaviors — like Timestamp, Sluggin...
[Symfony Bundle] Entity Kit Bundle
https://github.com/abdellahrk/EntityKitBundle
https://redd.it/1k3s2au
@r_php
https://github.com/abdellahrk/EntityKitBundle
https://redd.it/1k3s2au
@r_php
GitHub
GitHub - abdellahrk/EntityKitBundle: Entity Bundle Kit is a modern Symfony bundle that gives your Doctrine entities superpowers…
Entity Bundle Kit is a modern Symfony bundle that gives your Doctrine entities superpowers with minimal boilerplate. It provides a growing collection of prebuilt behaviors — like Timestamp, Sluggin...
Weekly Ask Anything Thread
Feel free to ask any questions you think may not warrant a post. Asking for help here is also fine.
https://redd.it/1k43szz
@r_php
Feel free to ask any questions you think may not warrant a post. Asking for help here is also fine.
https://redd.it/1k43szz
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
Weekly help thread
Hey there!
This subreddit isn't meant for help threads, though there's one exception to the rule: in this thread you can ask anything you want PHP related, someone will probably be able to help you out!
https://redd.it/1k46h74
@r_php
Hey there!
This subreddit isn't meant for help threads, though there's one exception to the rule: in this thread you can ask anything you want PHP related, someone will probably be able to help you out!
https://redd.it/1k46h74
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Add Engaging Animations To Your Webapp for FREE
https://backpackforlaravel.com/articles/tutorials/add-engaging-animations-to-your-web-app-for-free
https://redd.it/1k47e3x
@r_php
https://backpackforlaravel.com/articles/tutorials/add-engaging-animations-to-your-web-app-for-free
https://redd.it/1k47e3x
@r_php
Backpack for Laravel
Add Engaging Animations To Your Webapp for FREE
Lottie animations have become a popular choice for adding rich, engaging animations to websites and apps. They’re lightweight, scalable...
I want to optimze this code, Now it just pending, not getting rendered html
public function getFilterData(Request $request)
{
try {
$sbu = $request->sbu;
$location = $request->location;
$customer = $request->customer;
$salesRep = $request->salesRep;
$asAt = $request->asAt;
$html = ''; //html table
//common style
$styles = [
'borderTop' => 'border-top: 2px solid #000;',
'borderBottom' => 'border-bottom: 1px solid #000; border-bottom: 3px double #000;',
'textAlign' => 'text-align: right;',
];
$count = 1; //count
$data = $this->requiredData($sbu, $location, $customer, $salesRep, $asAt, $request);
//grouped data
$groupedCollection = $data->groupBy('cti');
//all sum
$totalAmountSumAll = 0;
$paymentSumAll = 0;
$balanceSumAll = 0;
$oneOverDueSumAll = 0;
$twoOverDueSumAll = 0;
$threeOverDueSumAll = 0;
$fourOverDueSumAll = 0;
$fiveOverDueSumAll = 0;
$sixOverDueSumAll = 0;
$lateFeesSumAll = 0;
$totalDueSumAll = 0;
//set table data
$callingCod = '';
if ($groupedCollection != null) {
foreach ($groupedCollection as $key => $group) {
$customerCode = isset($group[0]['cusCode']) ? $group[0]['cusCode'] : null;
$customerName = isset($group[0]['cusName']) ? $group[0]['cusName'] : null;
$callingCode = isset($group[0]['cCodeGMoNo']) ? $group[0]['cCodeGMoNo'] : null;
$mobileNo = isset($group[0]['gBNo']) ? $group[0]['gBNo'] : null;
//set calling code
$cCode = $this->callingCode($callingCode);
if (!empty($cCode) && isset($cCode[0]['callingCode'])) {
$callingCod = $cCode[0]['callingCode'];
}
$html .= '<tr>
<td></td>
<td colspan="4"><strong>' . $customerCode . ' : ' . $customerName . (!empty($mobileNo) ? ' | +' . $callingCod . ' ' . $mobileNo : '') . '</strong></td>
</tr>';
//customer wise sum
$totalAmountSum = 0;
$paymentSum = 0;
$balanceSum = 0;
$oneOverDueSum = 0;
$twoOverDueSum = 0;
$threeOverDueSum = 0;
$fourOverDueSum = 0;
$fiveOverDueSum = 0;
$sixOverDueSum = 0;
$lateFeesSum = 0;
$totalDueSum = 0;
// Apply chunking to the group processing - chunk size of 100 can be adjusted
$chunkSize = 100;
$chunks = array_chunk($group->toArray(), $chunkSize);
foreach ($chunks as $chunk) {
// Process each chunk of items
foreach ($chunk as $item) {
//get date difference
$asAtDate = Carbon::parse($asAt);
$effectiveDate = !empty($item['invoiceDate']) ? $item['invoiceDate'] : (!empty($item['cicDate']) ? $item['cicDate'] : (!empty($item['odInvoiceDate']) ? $item['odInvoiceDate'] : null));
$effectiveDate = Carbon::parse($effectiveDate);
$overDueVal = $asAtDate->diffInDays($effectiveDate);
public function getFilterData(Request $request)
{
try {
$sbu = $request->sbu;
$location = $request->location;
$customer = $request->customer;
$salesRep = $request->salesRep;
$asAt = $request->asAt;
$html = ''; //html table
//common style
$styles = [
'borderTop' => 'border-top: 2px solid #000;',
'borderBottom' => 'border-bottom: 1px solid #000; border-bottom: 3px double #000;',
'textAlign' => 'text-align: right;',
];
$count = 1; //count
$data = $this->requiredData($sbu, $location, $customer, $salesRep, $asAt, $request);
//grouped data
$groupedCollection = $data->groupBy('cti');
//all sum
$totalAmountSumAll = 0;
$paymentSumAll = 0;
$balanceSumAll = 0;
$oneOverDueSumAll = 0;
$twoOverDueSumAll = 0;
$threeOverDueSumAll = 0;
$fourOverDueSumAll = 0;
$fiveOverDueSumAll = 0;
$sixOverDueSumAll = 0;
$lateFeesSumAll = 0;
$totalDueSumAll = 0;
//set table data
$callingCod = '';
if ($groupedCollection != null) {
foreach ($groupedCollection as $key => $group) {
$customerCode = isset($group[0]['cusCode']) ? $group[0]['cusCode'] : null;
$customerName = isset($group[0]['cusName']) ? $group[0]['cusName'] : null;
$callingCode = isset($group[0]['cCodeGMoNo']) ? $group[0]['cCodeGMoNo'] : null;
$mobileNo = isset($group[0]['gBNo']) ? $group[0]['gBNo'] : null;
//set calling code
$cCode = $this->callingCode($callingCode);
if (!empty($cCode) && isset($cCode[0]['callingCode'])) {
$callingCod = $cCode[0]['callingCode'];
}
$html .= '<tr>
<td></td>
<td colspan="4"><strong>' . $customerCode . ' : ' . $customerName . (!empty($mobileNo) ? ' | +' . $callingCod . ' ' . $mobileNo : '') . '</strong></td>
</tr>';
//customer wise sum
$totalAmountSum = 0;
$paymentSum = 0;
$balanceSum = 0;
$oneOverDueSum = 0;
$twoOverDueSum = 0;
$threeOverDueSum = 0;
$fourOverDueSum = 0;
$fiveOverDueSum = 0;
$sixOverDueSum = 0;
$lateFeesSum = 0;
$totalDueSum = 0;
// Apply chunking to the group processing - chunk size of 100 can be adjusted
$chunkSize = 100;
$chunks = array_chunk($group->toArray(), $chunkSize);
foreach ($chunks as $chunk) {
// Process each chunk of items
foreach ($chunk as $item) {
//get date difference
$asAtDate = Carbon::parse($asAt);
$effectiveDate = !empty($item['invoiceDate']) ? $item['invoiceDate'] : (!empty($item['cicDate']) ? $item['cicDate'] : (!empty($item['odInvoiceDate']) ? $item['odInvoiceDate'] : null));
$effectiveDate = Carbon::parse($effectiveDate);
$overDueVal = $asAtDate->diffInDays($effectiveDate);
//over due
$oneOverDue = 0;
$twoOverDue = 0;
$threeOverDue = 0;
$fourOverDue = 0;
$fiveOverDue = 0;
$sixOverDue = 0;
if ($overDueVal >= 1 && $overDueVal <= 7) {
$oneOverDue = $item['amount'] - $item['paymnt'];
} else if ($overDueVal >= 8 && $overDueVal <= 14) {
$twoOverDue = $item['amount'] - $item['paymnt'];
} else if ($overDueVal >= 15 && $overDueVal <= 30) {
$threeOverDue = $item['amount'] - $item['paymnt'];
} else if ($overDueVal >= 31 && $overDueVal <= 60) {
$fourOverDue = $item['amount'] - $item['paymnt'];
} else if ($overDueVal >= 61 && $overDueVal <= 90) {
$fiveOverDue = $item['amount'] - $item['paymnt'];
} else if ($overDueVal > 91) {
$sixOverDue = $item['amount'] - $item['paymnt'];
}
$balance = $item['amount'] - $item['paymnt']; //balance
$lateFee = $item['lateFee'] - $item['stlmntDiscnt'];
$totalDue = $balance + $lateFee; //total due
$html .= '<tr>
<td>' . $count++ . '</td>
<td>' . ($item['tty'] == 1 ? 'INV' : ($item['tty'] == 2 ? 'CHQ RTN' : ($item['tty'] == 3 ? 'CRD NO' : ($item['tty'] == 4 ? 'OTH CRD' : '')))) . '</td>
<td>' . (isset($item['invoiceNo']) ? $item['invoiceNo'] : (isset($item['inhandChequeNo']) ? $item['inhandChequeNo'] : (isset($item['oldInvoiceNo']) ? $item['oldInvoiceNo'] : ''))) . '</td>
<td>' . (!empty($item['invoiceDate']) ? $item['invoiceDate'] : (!empty($item['cicDate']) ? $item['cicDate'] : (!empty($item['odInvoiceDate']) ? $item['odInvoiceDate'] : '-'))) . '</td>
<td>' . (isset($item['invoiceNo']) && $item['invMrf'] !== null ? $item['invMrf'] : '-') . '</td>
<td style="text-align: right">' . (isset($item['creditPeriodDays']) ? $item['creditPeriodDays'] : 0) . ' Days' . '</td>
<td style="text-align: right">' . $item['remngDays'] . ' Days' . '</td>
<td style="text-align: right">' . ($item['amount'] !== 0.0 && $item['amount'] !== 0 ? number_format($item['amount'], 2) : '-') . '</td>
<td style="text-align: right">' . ($item['paymnt'] !== 0.0 && $item['paymnt'] !== 0 ? number_format($item['paymnt'], 2) : '-') . '</td>
<td style="text-align: right">' . number_format($item['amount'] - $item['paymnt'], 2) . '</td>
<td style="text-align: right">' . ($oneOverDue !== 0 && $oneOverDue !== 0.0 ? number_format($oneOverDue, 2) : '-') . '</td>
<td style="text-align: right">' . ($twoOverDue !== 0 && $twoOverDue !== 0.0 ? number_format($twoOverDue, 2) : '-') . '</td>
<td style="text-align: right">' . ($threeOverDue !== 0 && $threeOverDue !== 0.0 ? number_format($threeOverDue, 2) : '-') . '</td>
<td style="text-align: right">' . ($fourOverDue !== 0 && $fourOverDue !== 0.0 ? number_format($fourOverDue, 2) : '-') . '</td>
<td style="text-align: right">' . ($fiveOverDue !== 0 && $fiveOverDue !== 0.0 ? number_format($fiveOverDue, 2) : '-') . '</td>
$oneOverDue = 0;
$twoOverDue = 0;
$threeOverDue = 0;
$fourOverDue = 0;
$fiveOverDue = 0;
$sixOverDue = 0;
if ($overDueVal >= 1 && $overDueVal <= 7) {
$oneOverDue = $item['amount'] - $item['paymnt'];
} else if ($overDueVal >= 8 && $overDueVal <= 14) {
$twoOverDue = $item['amount'] - $item['paymnt'];
} else if ($overDueVal >= 15 && $overDueVal <= 30) {
$threeOverDue = $item['amount'] - $item['paymnt'];
} else if ($overDueVal >= 31 && $overDueVal <= 60) {
$fourOverDue = $item['amount'] - $item['paymnt'];
} else if ($overDueVal >= 61 && $overDueVal <= 90) {
$fiveOverDue = $item['amount'] - $item['paymnt'];
} else if ($overDueVal > 91) {
$sixOverDue = $item['amount'] - $item['paymnt'];
}
$balance = $item['amount'] - $item['paymnt']; //balance
$lateFee = $item['lateFee'] - $item['stlmntDiscnt'];
$totalDue = $balance + $lateFee; //total due
$html .= '<tr>
<td>' . $count++ . '</td>
<td>' . ($item['tty'] == 1 ? 'INV' : ($item['tty'] == 2 ? 'CHQ RTN' : ($item['tty'] == 3 ? 'CRD NO' : ($item['tty'] == 4 ? 'OTH CRD' : '')))) . '</td>
<td>' . (isset($item['invoiceNo']) ? $item['invoiceNo'] : (isset($item['inhandChequeNo']) ? $item['inhandChequeNo'] : (isset($item['oldInvoiceNo']) ? $item['oldInvoiceNo'] : ''))) . '</td>
<td>' . (!empty($item['invoiceDate']) ? $item['invoiceDate'] : (!empty($item['cicDate']) ? $item['cicDate'] : (!empty($item['odInvoiceDate']) ? $item['odInvoiceDate'] : '-'))) . '</td>
<td>' . (isset($item['invoiceNo']) && $item['invMrf'] !== null ? $item['invMrf'] : '-') . '</td>
<td style="text-align: right">' . (isset($item['creditPeriodDays']) ? $item['creditPeriodDays'] : 0) . ' Days' . '</td>
<td style="text-align: right">' . $item['remngDays'] . ' Days' . '</td>
<td style="text-align: right">' . ($item['amount'] !== 0.0 && $item['amount'] !== 0 ? number_format($item['amount'], 2) : '-') . '</td>
<td style="text-align: right">' . ($item['paymnt'] !== 0.0 && $item['paymnt'] !== 0 ? number_format($item['paymnt'], 2) : '-') . '</td>
<td style="text-align: right">' . number_format($item['amount'] - $item['paymnt'], 2) . '</td>
<td style="text-align: right">' . ($oneOverDue !== 0 && $oneOverDue !== 0.0 ? number_format($oneOverDue, 2) : '-') . '</td>
<td style="text-align: right">' . ($twoOverDue !== 0 && $twoOverDue !== 0.0 ? number_format($twoOverDue, 2) : '-') . '</td>
<td style="text-align: right">' . ($threeOverDue !== 0 && $threeOverDue !== 0.0 ? number_format($threeOverDue, 2) : '-') . '</td>
<td style="text-align: right">' . ($fourOverDue !== 0 && $fourOverDue !== 0.0 ? number_format($fourOverDue, 2) : '-') . '</td>
<td style="text-align: right">' . ($fiveOverDue !== 0 && $fiveOverDue !== 0.0 ? number_format($fiveOverDue, 2) : '-') . '</td>
<td style="text-align: right">' . ($sixOverDue !== 0 && $sixOverDue !== 0.0 ? number_format($sixOverDue, 2) : '-') . '</td>
<td style="text-align: right">' . ($lateFee !== 0.0 && $lateFee !== 0 ? number_format($lateFee, 2) : '-') . '</td>
<td style="text-align: right">' . ($totalDue !== 0.0 && $totalDue !== 0 ? number_format($totalDue, 2) : '-') . '</td>
</tr>';
$totalAmountSum += $item['amount'];
$paymentSum += $item['paymnt'];
$balanceSum += $balance;
$oneOverDueSum += $oneOverDue;
$twoOverDueSum += $twoOverDue;
$threeOverDueSum += $threeOverDue;
$fourOverDueSum += $fourOverDue;
$fiveOverDueSum += $fiveOverDue;
$sixOverDueSum += $sixOverDue;
$lateFeesSum += $lateFee;
$totalDueSum += $totalDue;
}
}
//set customer wise sum
$html .= '<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($totalAmountSum !== 0.0 && $totalAmountSum !== 0 ? number_format($totalAmountSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($paymentSum !== 0.0 && $paymentSum !== 0 ? number_format($paymentSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($balanceSum !== 0.0 && $balanceSum !== 0 ? number_format($balanceSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($oneOverDueSum !== 0.0 && $oneOverDueSum !== 0 ? number_format($oneOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($twoOverDueSum !== 0.0 && $twoOverDueSum !== 0 ? number_format($twoOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($threeOverDueSum !== 0.0 && $threeOverDueSum !== 0 ? number_format($threeOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($fourOverDueSum !== 0.0 && $fourOverDueSum !== 0 ? number_format($fourOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($fiveOverDueSum !== 0.0 && $fiveOverDueSum !== 0 ? number_format($fiveOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($sixOverDueSum !== 0.0 && $sixOverDueSum !== 0 ? number_format($sixOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($lateFeesSum !== 0.0 && $lateFeesSum !== 0 ? number_format($lateFeesSum, 2) : '-') . '</td>
<td style="text-align: right">' . ($lateFee !== 0.0 && $lateFee !== 0 ? number_format($lateFee, 2) : '-') . '</td>
<td style="text-align: right">' . ($totalDue !== 0.0 && $totalDue !== 0 ? number_format($totalDue, 2) : '-') . '</td>
</tr>';
$totalAmountSum += $item['amount'];
$paymentSum += $item['paymnt'];
$balanceSum += $balance;
$oneOverDueSum += $oneOverDue;
$twoOverDueSum += $twoOverDue;
$threeOverDueSum += $threeOverDue;
$fourOverDueSum += $fourOverDue;
$fiveOverDueSum += $fiveOverDue;
$sixOverDueSum += $sixOverDue;
$lateFeesSum += $lateFee;
$totalDueSum += $totalDue;
}
}
//set customer wise sum
$html .= '<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($totalAmountSum !== 0.0 && $totalAmountSum !== 0 ? number_format($totalAmountSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($paymentSum !== 0.0 && $paymentSum !== 0 ? number_format($paymentSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($balanceSum !== 0.0 && $balanceSum !== 0 ? number_format($balanceSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($oneOverDueSum !== 0.0 && $oneOverDueSum !== 0 ? number_format($oneOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($twoOverDueSum !== 0.0 && $twoOverDueSum !== 0 ? number_format($twoOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($threeOverDueSum !== 0.0 && $threeOverDueSum !== 0 ? number_format($threeOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($fourOverDueSum !== 0.0 && $fourOverDueSum !== 0 ? number_format($fourOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($fiveOverDueSum !== 0.0 && $fiveOverDueSum !== 0 ? number_format($fiveOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($sixOverDueSum !== 0.0 && $sixOverDueSum !== 0 ? number_format($sixOverDueSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($lateFeesSum !== 0.0 && $lateFeesSum !== 0 ? number_format($lateFeesSum, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($totalDueSum !== 0.0 && $totalDueSum !== 0 ? number_format($totalDueSum, 2) : '-') . '</td>
</tr>';
$totalAmountSumAll += $totalAmountSum;
$paymentSumAll += $paymentSum;
$balanceSumAll += $balanceSum;
$oneOverDueSumAll += $oneOverDueSum;
$twoOverDueSumAll += $twoOverDueSum;
$threeOverDueSumAll += $threeOverDueSum;
$fourOverDueSumAll += $fourOverDueSum;
$fiveOverDueSumAll += $fiveOverDueSum;
$sixOverDueSumAll += $sixOverDueSum;
$lateFeesSumAll += $lateFeesSum;
$totalDueSumAll += $totalDueSum;
}
// Rest of your code for total sum rows remains unchanged
$html .= '<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>';
$html .= '<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($totalAmountSumAll !== 0 && $totalAmountSumAll !== 0.0 ? number_format($totalAmountSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($paymentSumAll !== 0 && $paymentSumAll !== 0.0 ? number_format($paymentSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($balanceSumAll !== 0 && $balanceSumAll !== 0.0 ? number_format($balanceSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($oneOverDueSumAll !== 0 && $oneOverDueSumAll !== 0.0 ? number_format($oneOverDueSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($twoOverDueSumAll !== 0 && $twoOverDueSumAll !== 0.0 ? number_format($twoOverDueSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($threeOverDueSumAll !== 0 && $threeOverDueSumAll !== 0.0 ? number_format($threeOverDueSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($fourOverDueSumAll !== 0 && $fourOverDueSumAll !== 0.0 ? number_format($fourOverDueSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($fiveOverDueSumAll !== 0 && $fiveOverDueSumAll !== 0.0 ? number_format($fiveOverDueSumAll, 2) : '-') . '</td>
</tr>';
$totalAmountSumAll += $totalAmountSum;
$paymentSumAll += $paymentSum;
$balanceSumAll += $balanceSum;
$oneOverDueSumAll += $oneOverDueSum;
$twoOverDueSumAll += $twoOverDueSum;
$threeOverDueSumAll += $threeOverDueSum;
$fourOverDueSumAll += $fourOverDueSum;
$fiveOverDueSumAll += $fiveOverDueSum;
$sixOverDueSumAll += $sixOverDueSum;
$lateFeesSumAll += $lateFeesSum;
$totalDueSumAll += $totalDueSum;
}
// Rest of your code for total sum rows remains unchanged
$html .= '<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>';
$html .= '<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($totalAmountSumAll !== 0 && $totalAmountSumAll !== 0.0 ? number_format($totalAmountSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($paymentSumAll !== 0 && $paymentSumAll !== 0.0 ? number_format($paymentSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($balanceSumAll !== 0 && $balanceSumAll !== 0.0 ? number_format($balanceSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($oneOverDueSumAll !== 0 && $oneOverDueSumAll !== 0.0 ? number_format($oneOverDueSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($twoOverDueSumAll !== 0 && $twoOverDueSumAll !== 0.0 ? number_format($twoOverDueSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($threeOverDueSumAll !== 0 && $threeOverDueSumAll !== 0.0 ? number_format($threeOverDueSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($fourOverDueSumAll !== 0 && $fourOverDueSumAll !== 0.0 ? number_format($fourOverDueSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($fiveOverDueSumAll !== 0 && $fiveOverDueSumAll !== 0.0 ? number_format($fiveOverDueSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($sixOverDueSumAll !== 0 && $sixOverDueSumAll !== 0.0 ? number_format($sixOverDueSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($lateFeesSumAll !== 0 && $lateFeesSumAll !== 0.0 ? number_format($lateFeesSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($totalDueSumAll !== 0 && $totalDueSumAll !== 0.0 ? number_format($totalDueSumAll, 2) : '-') . '</td>
</tr>';
} else {
$html .= '<tr>
<td colspan="18">
<div role="alert" class="alert alert-warning alert-dismissible fade show" style="text-align: center;">
' . __("finance/reports/debtor_aging_details.data_empty_massage") . '
</div>
</td>
</tr>';
}
return response()->json(['stts' => 1, 'data' => $html]);
} catch (Exception $e) {
dd($e);
$randomErrorCode = errorLog(authrz_debtorAgingDetails("transaction"), $request, $e, $this->datetime);
return response()->json(['stts' => 0, "mssg" => __('message.danger'), "rfms" => __('message.dangerRef', ['refr' => $randomErrorCode]), "burl" => '#']);
}
}
I want to optimize above function and can't affect to its calculation and ui
https://redd.it/1k488xh
@r_php
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($lateFeesSumAll !== 0 && $lateFeesSumAll !== 0.0 ? number_format($lateFeesSumAll, 2) : '-') . '</td>
<td style="' . $styles['borderTop'] . ' ' . $styles['borderBottom'] . ' ' . $styles['textAlign'] . '">' . ($totalDueSumAll !== 0 && $totalDueSumAll !== 0.0 ? number_format($totalDueSumAll, 2) : '-') . '</td>
</tr>';
} else {
$html .= '<tr>
<td colspan="18">
<div role="alert" class="alert alert-warning alert-dismissible fade show" style="text-align: center;">
' . __("finance/reports/debtor_aging_details.data_empty_massage") . '
</div>
</td>
</tr>';
}
return response()->json(['stts' => 1, 'data' => $html]);
} catch (Exception $e) {
dd($e);
$randomErrorCode = errorLog(authrz_debtorAgingDetails("transaction"), $request, $e, $this->datetime);
return response()->json(['stts' => 0, "mssg" => __('message.danger'), "rfms" => __('message.dangerRef', ['refr' => $randomErrorCode]), "burl" => '#']);
}
}
I want to optimize above function and can't affect to its calculation and ui
https://redd.it/1k488xh
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Backup laravel mail Sender
Is there a way to have a bacup mail Sender, example: my main sender returned some kind of error, so the app tries to send in another one.
I did some research and find nothing about it.
https://redd.it/1k4efo7
@r_php
Is there a way to have a bacup mail Sender, example: my main sender returned some kind of error, so the app tries to send in another one.
I did some research and find nothing about it.
https://redd.it/1k4efo7
@r_php
Reddit
From the laravel community on Reddit
Explore this post and more from the laravel community
Laravel but static?
A while back I did this small static site using jigsaw plus some simple form handling in php. It worked fine, wasn't my favorite to work with, and I kept thinking I should just have just gone with insert framework here behind cloudflare with some aggressive caching... But something something sunk cost lets just keep going.
Fast forward maybe 6 months, and I see the static pages feature in tempest and I have a "yeah that makes perfect sense, why didn't I think of that" moment.
So since I already have a bunch of blade templates for this site I decided to see what it would take to get static pages in laravel. Simpler than I expected...
https://github.com/ssnepenthe/mostly-static
It's a bit rough around the edges and I doubt I will spend much time improving it/cleaning it up. But I thought I would share in case anyone else finds it useful as a starting point for doing something similar.
https://redd.it/1k4tnzl
@r_php
A while back I did this small static site using jigsaw plus some simple form handling in php. It worked fine, wasn't my favorite to work with, and I kept thinking I should just have just gone with insert framework here behind cloudflare with some aggressive caching... But something something sunk cost lets just keep going.
Fast forward maybe 6 months, and I see the static pages feature in tempest and I have a "yeah that makes perfect sense, why didn't I think of that" moment.
So since I already have a bunch of blade templates for this site I decided to see what it would take to get static pages in laravel. Simpler than I expected...
https://github.com/ssnepenthe/mostly-static
It's a bit rough around the edges and I doubt I will spend much time improving it/cleaning it up. But I thought I would share in case anyone else finds it useful as a starting point for doing something similar.
https://redd.it/1k4tnzl
@r_php
Tempestphp
Static pages — Tempest
Tempest is a modern framework designed to enable developers to write as little framework-specific code as possible, so that they can focus on application code instead.