Skip to content

Make use of helpers function and remember to make add_debug true on production #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,30 @@ $apiKey = config('api.key');

[🔝 Back to contents](#contents)

### **Use helper functions provided in Illuminate/Support**

There are numerous helper functions provided in Illuminate/Support, this can be used anywhere in the application, instead of trying to invent the wheel by writing your own PHP helpers, which is unsafe and can be challenging.

Bad:
```php
public function uniqueId()
{
$str_result = '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjklmnpqrstuvwxyz';

$id = substr(str_shuffle($str_result), 0, 24);
}

Good
public function uniqueId()
{
....
$id = Str::random(24);
....
}
```

[🔝 Back to contents](#contents)

### **Store dates in the standard format. Use accessors and mutators to modify date format**

Bad:
Expand Down Expand Up @@ -662,4 +686,6 @@ Use modern PHP syntax where possible, but don't forget about readability.

Avoid using View Composers and similar tools unless you really know what you're doing. In most cases, there is a better way to solve the problem.

After you have done all you can to secure the application. One final reminder is to make sure you don't forget to set APP_DEBUG=TRUE in the .env file. If you leave the debug mode enabled, hackers will be able to access some private parts of your code as well as configuration information and third-party login credentials.

[🔝 Back to contents](#contents)