What is PHP CS Fixer
PHP CS Fixer stands for PHP Coding Standards Fixer. This is a tool that fixes your code to follow standards. There are various PHP coding standards that you can follow, such as the popular PSR-1, and PSR-12 published by the PHP Framework Interoperability Group (the full list...
The difference between POST and PUT according to RFC
According to RFC 2616, § 9.5, POST is used to create a resource:
According to RFC 2616, § 9.6, PUT is used to create or replace a resource:
Let's find out which HTTP method should be used to create a resource.
Or should both be...
Idempotent HTTP methods
An idempotent HTTP method is a method that can be invoked many times without different outcomes. It does not matter whether the method was called only once or ten times. The result should always be the same. Idempotency essentially means that the result of a successfully...
🚀 What's new
Added Open Graph and Twitter Cards images along with additional SEO tags for social sharing. *
Several improvements have been made to optimize page load times. Served some assets using CDN.
* Twitter Social Share preview.
Design Patterns
Design Patterns are techniques for how to design and architect your code. They are low-level solutions related to the implementation to real-world problems that arise again and again, so instead of inventing the wheel, we follow design patterns that are well-proven, tested by...
This week has been more intense than usual, so the fourth version of the Shadow Legion website has only one improvement.
🚀 What's new
Added the ability to view attachments/images to posts for unregistered users (guests).
Laravel Tip #4
Did you know about the $ loop variable in Laravel? This is an object that contains useful information about the current iteration of the loop.
The third update of the Shadow Legion website took place this week.
🚀 What's new
Added new forum: PHP.
Added new tags: #what-is and #how-to. You can use them to view new educational threads or tutorials.
Added two sticky topics that will be updated regularly: Laravel Tips and Tricks and PHP...
Laravel Tip #2
Here is an example of how to convert an array of paragraphs to HTML string with <p> tags.
I like to use this approach when working with fake data (factories) in Laravel.
Like Laravel Tips and Tricks, I will post here Tips and Tricks for PHP, but less regularly.
If this is something you are interested in, make sure you follow/watch this thread.
PHP Tip #1
Here is an example of how to convert an array of paragraphs to HTML string with <p> tags.
Personally...
Starting today, I will be posting one to two Laravel refactoring tips a week. If this is what you are interested in, you can follow/watch this thread.
I will also make it sticky so that it is fixed at the top of the list under the Laravel (PHP Framework) forum.
Laravel Tip #1
Here is an...
Today, Linux is in great demand. You can see its use everywhere, on servers, desktops, smartphones, and even some electrical devices such as refrigerators. Some people consider Unix and Linux as synonyms, but that is not true. Let's take a closer look.
Unix
Before Linux and Windows, the...
Service Classes
A service class is a class that performs some business logic that you want to use in various places.
It is any PHP object that performs some sort of a "global" task.
When code does not naturally fit into one class or another nicely then you have a candidate for a service. For...
The second update of the Shadow Legion website took place this week.
🚀 What's new
Added new forum: XenForo (PHP-based CMS).
Added new trophies for forum members.
Configured rank titles for forum members.
Displayed a list of followers in several parts on the website (user profile page, user...
Definition
Invokable Controller is a controller that contains only one (__invoke()) method.
The __invoke() method is a magic method that is called when a script tries to call an object/class as a function.
Invokable controllers come in handy when you need to create a controller that does one...
Here is the .gitignore template for XenForo I created myself (since I could not find a good example on the Internet).
Please, share if you have any ideas on how to extend or modify it.
# XenForo Specific
data/
internal_data/
js/swfupload/
js/vendor/
js/videojs/
js/xf/*.min.js...
To dump / debug a variable in XenForo templates, all you need to do is call the dump() method passing the variable as a parameter:
{{ dump($variable) )}}
In this article, I will show you how to create a cron job to automate the /tmp directory clean-up process in Linux.
I am going to use the script described in the previous thread about the Linux /tmp directory:
find /tmp -type f \( ! -user root \) -atime +5 -delete
This script finds temporary...
The Linux /tmp directory
The /tmp directory in Linux-based systems contains the necessary files that the system temporarily needs, as well as other software and applications running on the machine.
For example, when you are writing a document, all the contents of that document are saved as a...
The only difference between hasOne/hasMany and belongsTo/belongsToMany is where the foreign key column is located.
hasOne and hasMany - you are telling Laravel that this table does not have the foreign key.
belongsTo and belongsToMany - you are telling Laravel that this table holds the foreign...
Birthday Trophy
Award to members on their birthday.
Likes Per Thread
User has obtained 10 likes on a single thread.
User has obtained 25 likes on a single thread.
User has obtained 50 likes on a single thread.
User has obtained 100 likes on a single thread.
Trophies for "liking" other...
Please share if anyone has ideas for new forum trophies. Currently, there are ones for total posts and total reactions earned, among others.
You can find the list of current trophies here.
The Shadow Legion website was successfully launched on March 17, 2022. Further updates will take place and be documented in this forum.
🚀 What's new
The forum engine has been installed and configured.
Redesigned the default forum template.
Installed a new Inter font.
Created a basic content...