PHP Reddit – Telegram
PHP Reddit
34 subscribers
292 photos
37 videos
24.9K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
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/1jntxdp
@r_php
Should I Master Pure PHP Before Becoming a Laravel Expert?

To become a master of Laravel, do I need to be really proficient in pure PHP first? I already have programming skills, understand OOP, and know PHP syntax along with common functions. I also built my graduation project using Laravel. However, I don't have a deep understanding of Laravel yet. I have never built a complete system with pure PHP, nor have I manually implemented models like MVC from scratch.

I want to gain deep understanding to optimize performance and enhance security as well. So, should I develop a complete system using pure PHP first?

https://redd.it/1jnu1yn
@r_php
How do you handle client requested data changes?

Lets say you deployed an app for a client.

Now the client comes back to you and requests some data to be changed, like wording in a table column. Or maybe changing the parent\\child of some data...

1. Create migration to change the data
2. Edit manually in SQL tooling
3. Create a custom endpoint that applies it in code
4. ...?

What's best practice here?

(To be clear, not database structure changes)

https://redd.it/1jo2wek
@r_php
Is route:cache enough for mostly-static websites?

I'm working on a small e-commerce website that sells 7 products in total. Which gets the products from the database. And the data doesn't change often (if at all).

So, what kind of caching method would you recommend for this? Do I use something like Cache::rememberforever and re-set the cache when model changes? Or would php artisan route:cache command be enough for this purpose?

https://redd.it/1joc2ju
@r_php
Improving at Legacy Code

I don't know if this is the right place to ask this, but I've come to the conclusion that (entirely unintentionally) my career has made me specialise in Legacy code over the last few years.

However, I've been wondering what the best way is for me to get "better" at dealing with legacy code. I think it would be a nice skill to have on my CV if/when I move on to a new job, and likely something that will never be entirely useless. So far it's been mostly by accident but I wonder where I would go from here if I were more intentional about it.


(Apologies if this qualifies as "asking for help", I intend it mostly as a discussion and to hear from others in a similar position.)

https://redd.it/1jodq69
@r_php
PHP-FPM with latest news from 2011
https://php-fpm.org/

https://redd.it/1joe1fq
@r_php
Vote: Facades, helpers, or pure DI?

\\"Pure\\" DI

Helper functions

Facade

What is your preferred way of doing it?

Please, elaborate.

https://redd.it/1jogk9u
@r_php
PHP Crash Course by Matt Smith

I've been meaning to learn PHP for a while now, but life got in the way. I remember Jon Duckett, Program with Gio, and Laracasts as being much recommended sources to learn from. However, I also noticed a book that came out very recently: PHP Crash Course by Matt Smith. I like that it's recent and that it provides exercises with each chapter.

Does anyone here have experience with this book? Or does it seem like it focuses on the right subjects? There's a nice sample to look through at the link above.

https://redd.it/1jorxih
@r_php
NelmioApiDocBundle

Hi everyone, I’m using nelmio v5.0.1 with swagger v4.8.7 is there any way to create global parameters for route /api/ ? I have authentication by headers (Auth-Login and Auth-Password) and I don’t want to put it in every controller under /api/…

https://redd.it/1jot2le
@r_php
Handling large array without going over memory limit

Greetings. I have a large file with formatted multidimensional json i need to process. Currently I am using file_get_contents(), which sometimes ends in error "Allowed memory size exhausted".

I tried using fopen()/fgets(), but working with it seems a bit tricky:

1. It's a multidimensional array and fgets() returns a string that can't be parsed via json_decode(), like so: ' "Lorem": "Ipsum",'. Am I supposed to trim trailing commas and spaces and add brackets myself?

2. Do I need to check every line for closing }] to parse nested array myself?

Sorry if it's a stupid question, not really that familiar with PHP.

https://redd.it/1jovotx
@r_php