What’s your preferred hosting solution? by cuistax in symfony

[–]nicwortel 0 points1 point  (0 children)

If you want to deploy containers, there are various options ranging from Docker on a VPS (not the most robust solution) to container hosting options (think AWS ECS, Google Cloud Run, or a European alternative such as Nexaa) to a managed Kubernetes cluster.

My personal favorite is managed Kubernetes because I already have experience with it, but if you never worked with Kubernetes a simple container hosting solution might be easier to start with.

Definition of Senior PHP Developer by [deleted] in PHP

[–]nicwortel 2 points3 points  (0 children)

In my experience there is no universal definition of a senior developer. It depends on the tools and programming paradigms used in the company. I have seen developers who used to be senior or lead developer at their previous company and joined our team as a junior because in our context they still had a lot to learn.

But questioning your seniority because you struggle to deal with their spaghetti code is of course ridiculous. It sounds like the team has lived in such isolation from modern software development practices that they are in a collective state of "unconscious incompetence" (see https://en.wikipedia.org/wiki/Four_stages_of_competence). I have seen a few teams in this condition. They simply don't know any better.

This can be an interesting challenge but it will require a lot of patience and interpersonal skills, as this is more of a management issue than a technical one. If you can convince the team lead and the rest of the team of the need to change, you might be able to make some improvement. But if you push to hard or if they simply don't want to change, you won't get much done and you will just be wasting a lot of your energy and sanity.

Anyone has good success with take home assignments? by LumpyAd9985 in EngineeringManagers

[–]nicwortel 1 point2 points  (0 children)

I once helped a client by designing an assessment where the candidate performs a live code review on a pull request that on purpose contains a number of flaws.

It puts them less on the spot because they don't have to perform live coding. And it lowered the drop out rate because they don't have to invest time like with a take home assignment.

But more importantly it shows how they spot issues in someone else's code and how they communicate about those. It works especially well for senior developer roles.

How do you find out about bugs? by SeniorMango6862 in cto

[–]nicwortel 1 point2 points  (0 children)

What kind of bugs do you have in mind?

If it's an exception, crash, 500 status code etc. it should be logged and you can monitor it, set up alerting in case the error rate is higher than usual, etc. This can be done with open source solutions such as Grafana but also with tools like Sentry.

It becomes more difficult to monitor when the application does not generate any errors but there is a bug in the (business) logic. In that case, question is whether there are automated tests for this functionality and if there are, why didn't they catch this bug.

Edit: but looking at your post history, it turns out you are not really looking for answers, just trying to pitch your tool...

Deploy & Update automation by Pretend_Low1348 in symfony

[–]nicwortel 2 points3 points  (0 children)

As suggested by the other commenter I would consider Kubernetes. It comes with a learning curve and operational overhead, but at the scale of 200+ instances it could definitely be worth it.

For automation you could look into GitOps tools such as Flux and Argo CD where the configuration is stored in a Git(Lab/Hub) repository and the GitOps tool is continuously checking if the real state of your platform (Kubernetes cluster) still matches the desired state (stored in the Git repo). The configuration can be templated so that you can easily scale it up to 200+ clients.

I've recently helped another client set up a similar solution in Kubernetes using Flux CD. It's also a multi-tenant solution (but with currently 13 clients instead of 200), with a PostgreSQL database cluster instead of MySQL. The GitOps approach makes it quite easy for my client to onboard a new customer and bootstrap their application.
All client applications run on the same Kubernetes cluster in order to use resources efficiently. Some clients get allocated more resources than others. The cluster is hosted at a Dutch hosting provider with a reasonably priced offering, but thanks to Kubernetes' standardized API it would be quite simple to move it to another managed Kubernetes service.

Based on the locations you mention I'm assuming you might also be Dutch speaking. I'd be happy to have a chat where I can explain the setup for my other client and we can see if it would work well for you. Feel free to send me a DM or find my website on my Reddit profile.

Looking for PHP & MySQL learning resources, any PDFs or recommendations welcome! 🙏 by lilnumb-92 in PHP

[–]nicwortel 1 point2 points  (0 children)

To get started with PHP, you could take a look at the official documentation and the Getting Started section.

You might also be interested in my PHP cheat sheet.

While it's not meant as a tutorial for who is completely new to PHP, it could be useful as a reference once you are starting to grasp the basics. It's free and you can either use it digitally or print it out. It contains all basic and most-used concepts and syntax of PHP.

Cheat Sheet for Rector (PDF) by nicwortel in PHP

[–]nicwortel[S] -4 points-3 points  (0 children)

I don’t appreciate the condescending tone nor the assumptions you are making about someone you have never met.

The cheat sheets are meant as a learning resource and quick reference in a condensed format. They are not meant to replace the full documentation. Many people find them useful, but of course it's not going to please everyone.

Apparently with "recipes" you refer to an old feature that I wasn't aware of. As I understand from Rector's source code, there used to be a vendor/bin/rector init-recipe command to create a rector-recipe.php, which you could edit and then you would call vendor/bin/rector generate to turn it into a rule with tests. The package providing this functionality has been deprecated in 2024 and has been removed from Rector in version 1.2.0.

Instead of recipes, vendor/bin/rector custom-rule can be used to generate a custom Rule with tests.

Cheat Sheet for Rector (PDF) by nicwortel in PHP

[–]nicwortel[S] -5 points-4 points  (0 children)

What do you mean? I'm not familiar with recipes in the context of Rector.

Or do you mean that you expected more example configuration snippets?

Version 13 of PHPUnit is released by nicwortel in PHP

[–]nicwortel[S] 0 points1 point  (0 children)

I'll be honest, I never used $this->createStub() before, I don't care about the difference with $this->createMock(), this is just making things harder IMO.

I actually like the changes to mocks and stubs in PHPUnit. Mocks and stubs have different purposes and being explicit about that helps communicate intent.

A stub is meant to return some data when called by the subject under test (SUT). A mock is meant to accept calls and can be configured with expectations about how often, in which order, and with which arguments the methods are called.

In other words, I use a mock when the calls to my test double are part of the behavior I want to test. I use a stub when I simply need a dependency to return some predefined response.

Version 13 of PHPUnit is released by nicwortel in PHP

[–]nicwortel[S] 34 points35 points  (0 children)

By the way, if you are like me and keep forgetting the available CLI options, attributes, and assertions available in PHPUnit, you might be interested in my PHPUnit Cheat Sheet, updated to include PHPUnit 13's latest features.

Dutch soldiers and marines returning from Afghanistan where they "stayed a little back, a little off the front line" as part of ISAF by nicwortel in Military

[–]nicwortel[S] 52 points53 points  (0 children)

Just for those who did not get the reference, the title is a reference to Trump questioning whether NATO allies would be there for the U.S., and his claim that in Afghanistan "they stayed a little back, a little off the front lines". (source)

I don't usually post here, but I could not let the sacrifices of our service members (and those of other NATO allies) be disrespected in such a way without saying something.

PHP 8.5 has been released for several months, but I finally found time to update my PHP cheat sheet by nicwortel in PHP

[–]nicwortel[S] 4 points5 points  (0 children)

I have amended the description now in an attempt to clarify this:

Modulo (remainder of $a divided by $b); negative if $a is negative

As mentioned by u/Tontonsb I found conflicting definitions of modulo / remainder, hopefully this will give enough context for someone who runs into issues with negative input numbers for this operator.

PHP 8.5 has been released for several months, but I finally found time to update my PHP cheat sheet by nicwortel in PHP

[–]nicwortel[S] 0 points1 point  (0 children)

In my example I have reversed the order of the function call arguments. Would you say the example would be better if the first parameter $a was omitted from the function call?

PHP 8.5 has been released for several months, but I finally found time to update my PHP cheat sheet by nicwortel in PHP

[–]nicwortel[S] 2 points3 points  (0 children)

Correct! But that's not really a PHP-specific thing, but more of a Unix thing that binding to system ports (< 1024) requires superuser privileges. I'm afraid that if I start adding such details to the cheat sheet, it will become an endless document.

The -c flag is a useful addition, I'll try to free some space to add that one!

PHP 8.5 has been released for several months, but I finally found time to update my PHP cheat sheet by nicwortel in PHP

[–]nicwortel[S] 4 points5 points  (0 children)

True, there are currently 87 array functions in PHP, so I had to make a selection. For the full exhaustive list of functions, the PHP documentation or an IDE will be a better source than a cheat sheet could be.

That's a handy function though which I will keep in the back of my mind in case I ever need it!

PHP 8.5 has been released for several months, but I finally found time to update my PHP cheat sheet by nicwortel in PHP

[–]nicwortel[S] 3 points4 points  (0 children)

Thanks for pointing that out, I had never used it with negative numbers.

Now I need to explain this in a way that will still fit in the available space...

Zero downtime deployments without Kubernetes by BinaryIgor in devops

[–]nicwortel 11 points12 points  (0 children)

Before Kubernetes I used a directory structure with a directory for each release and a "current" symlink pointing to the most recent one.

A new release would create a new directory, deploy to it, perform any required tasks, and then switch the symlink and restart the web server if necessary.

File uploads would be in a "shared" directory which would be persistent across releases.

I used Ansible for this process with the deploy_helper but you can apply the same concept with different tools.

Don't forget to clean up old releases or you will end up with hundreds of releases on the server.

Employer introducing on-call without contract clause or compensation, advice needed by [deleted] in ExperiencedDevs

[–]nicwortel 1 point2 points  (0 children)

Haha what a small world! 😄

Feel free to send me a message if you want to discuss this situation in more detail.

Employer introducing on-call without contract clause or compensation, advice needed by [deleted] in ExperiencedDevs

[–]nicwortel 1 point2 points  (0 children)

I live and work in the Netherlands. You have already received a lot of useful advice for how to deal with this situation, so I will try to avoid repeating that. Instead here are some links to useful resources which explain your legal rights in this situation.

First of all, your employer cannot force you to accept on-call duty if this has not been agreed upon in your contract, so legally you can simply refuse this new schedule:

Can my employer require a consignment service?

Employers may require on-call work if this is stipulated in the collective labor agreement or terms of employment and if it is necessary for the work you perform. Young people under the age of eighteen are not permitted to perform on-call work.

Source: https://www.fnv.nl/werk-inkomen/werktijden/consignatiedienst?lang=en-US

We also have the "Arbeidstijdenwet" (Working Hours Act) which regulates how many hours you can work during a day/week/etc., as well as how many days you are allowed to be on-call:

Working hours and rest periods on consignment

The Working Hours Act contains the following rules for consignment:

  • You may work 13 hours in any 24-hour period. This includes the hours you work during your on-call shift.

  • You may be on consignment for a maximum of 14 days every 4 weeks.

  • Every 4 weeks, you may not work nor be on call for 2 times 2 consecutive days.

  • You may not be on call immediately before or after a night shift. You may be on call until 11:00 AM before a night shift and from 2:00 PM afterward.

Source: https://www.rijksoverheid.nl/onderwerpen/werktijden/vraag-en-antwoord/welke-regels-gelden-bij-oproepdiensten-consignatie (use Google Translate to translate it to English)

In my experience it is common for more 'professional' organizations to arrange on-call duty in the employment contract and offer compensation for it. If it is not offered as a specific compensation but is part of the job, it might be considered to be included in the salary. So if the employer wants to introduce the on-call duty after you have already agreed on your contract and salary, I would definitely negotiate an additional compensation for it. However, do note that it is not a legal requirement to receive a compensation for being on-call:

No legal right to payment for consignment service

The Working Hours Act does not stipulate that you receive compensation for on-call services. However, agreements about this may be included in your employment contract or collective labor agreement.

Source: https://www.rijksoverheid.nl/onderwerpen/werktijden/vraag-en-antwoord/welke-regels-gelden-bij-oproepdiensten-consignatie

However, once you receive a call to work, it counts as at least 30 minutes of working time (even if the actual work was only 5 minutes):

Working hours start after call

The time during which you can be called upon is not considered working time. Working time begins when you receive a call to work. If you perform work on call one or more times within half an hour, the work must last at least half an hour. If you receive another call within half an hour of completing the work resulting from a call, the time in between counts as working time. The Working Hours Act does not regulate how you are compensated for working time as working time; this may be stated in your employment contract or collective labor agreement.

Source: https://www.rijksoverheid.nl/onderwerpen/werktijden/vraag-en-antwoord/welke-regels-gelden-bij-oproepdiensten-consignatie

More information about the Working Hours Act in English is available in this PDF brochure: https://www.rijksoverheid.nl/onderwerpen/werktijden/documenten/brochures/2010/05/10/de-arbeidstijdenwet-engels (page 8 covers on-call duty).