26th September, 2023
If you wish to process a very large number of rows from a database then it may be prohibitively expensive to load them all into memory first. Laravel’s chunk()
function may look like the solution however this performs a query for each chunk and is therefore extremely slow.
The ideal solution is to disable query buffering and thereby only ever have a single row in memory at once. Note that this option is specific to the MySQL PDO driver.
Read More >
16th August, 2023
Impersonation is a useful tool: it allows an administrator to view the website as if they were logged in as another user, but without having to know their password. The Laravel documentation implies that you can do this using Auth::loginUsingId()
, but you will find that this doesn’t work.
Read More >
16th January, 2023
If you are running Laravel inside a Docker container and using Vite for Javascript/CSS bundling, you may find that the files fail to load when you view your website. You instead see one of the following errors:
- GET http://127.0.0.1:5173/@vite/client net::ERR_CONNECTION_REFUSED
- GET http://0.0.0.0:5173/@vite/client net::ERR_ADDRESS_INVALID
Read More >
19th April, 2022
If you are using Faker in your unit tests then you may encounter an “Unknown format” error. This means that either Faker does recognize the method that you are calling, or that Faker has not been initialized.
Read More >
20th December, 2021
If you use the types bool
or int
in a function or variable documentation comment block, PHP Codesniffer will give you an error:
Expected "boolean" but found "bool"
Expected "integer" but found "int"
Here’s a workaround!
Read More >
4th September, 2021
After losing a few hours debugging an obscure and difficult to reproduce issue, I can say that the touch()
function in Eloquent’s database model is best avoided.
Read More >
1st September, 2021
The Payment Services Directive 2 (PSD2) is a piece of EU and UK legislation that, among other things, mandates the use of a security protocol such as 3D Secure. 3D Secure until this point has been optional, but now it will be required for all online transactions. As well as now becoming mandatory, the protocol has been completely revised into version 2.
Upon adding 3D Secure v2 capability to my direct integration with Opayo (and upgrading from VPS Protocol v3 to v4, as is required), I found that certain customer transactions were being rejected by their bank, despite the majority going through successfully. No error message is given, just a failure response, and the session data threeDSSessionData
field being blank.
Read More >