Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ellajhonm's avatar

What's a good rule of thumb when deciding whether to just use a package or build from scratch when developing a new feature?

I'm thinking maybe time constraints, however some may argue that sometimes building from scratch saves more time than learning how to use a package/configuring a package. Thoughts?

0 likes
3 replies
jlrdw's avatar

Helper that just needs PHP code do yourself.

Something specialized like zipping a file or exporting to excel, use package.

2 likes
Sinnbeck's avatar

Also check if the package is well maintained. If you spend time on implementing a package only to have it be deprecated weeks later, might force you to reimplement the feature or take over maintenence of the package

2 likes
martinbean's avatar

@ellajhonm It’s the build versus but principle.

You need to weigh up if spending the time (and manpower) re-building something a package can offer you is worthwhile. Most people don’t want to write a view engine and router from scratch for every project, which is why they use a framework (which is just packages) like Laravel. Same principle applies for packages once your application is set up. Do you just install and configure a package, which may take a few minutes? Or do you have developers taking a salary spend their time re-writing that functionality only to end up at feature parity (the same features the package offered out of the box)?

Also, packages tend to be updated and tested, a burden you may not think of when writing your own code. Any code you write yourself, you then become the maintainers of. If you have a team of two, then a 2 million line codebase where you’ve decided to write everything from scratch could become unmanageable.

2 likes

Please or to participate in this conversation.