Skip to content

u/apresx

In this archive from Feb 2011 to Mar 2020

0
posts
18
comments
0
media
78
score

Don’t compromise stability over a single feature. Just use strictly typed constructor and setters. Mark your PHPDocs so you can go back and apply the types after it is released.

22 points

You should look into a producer/consumer messaging pattern, instead of constantly querying the database for new records. The process in charge of writing to the database can also produce a message (into a service bus) that a consumer picks up and performs the desired operation upon receipt. This will help with scalability.

19 points
  1. Did you declare global $app; in Employees.php?

  2. Including Employee.php must be done after $app is declared in index.php

And if you are doing any of this, you are probably approaching the problem the wrong way.

I used Slim on a project with tons of end points and I ran into the same issue. I ended up creating a wrapper class to build the $app and create all the routes.

The route methods call other classes where the application logic is tucked away.

I think slim encourages you to put the routes in the index for clarity.

2 points

Interesting. I just read a couple of weeks ago a PHP benchmark comparison between foreach vs. for where foreach took over 300% of the time of a for loop.

1 points

End of this list.

Back to top

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.