If you're inexperienced and the project is small, it's a good opportunity to
learn by trying to write it yourself.
If you're inexperienced and the project is not small, you will likely find that you are able to build a product or application
faster using a framework. If the project is results-focused, a framework may help you get to your intended result faster and with the end result having a more maintainable code base.
Do read through Getting Started docs, documentation related to what you'll be using the framework for, and quality open source implementations of the framework to get an idea of how to use the framework effectively.
That being said, if you
have a lot of time on your hands and want to focus more on learning PHP rather than building an app, then trying to
make your own code base from scratch can be a great learning experience. There are a lot of antipatterns and pitfalls to be had though, and you may very well rewrite your entire code base numerous times over. Be mindful of that, keep improving, keep reading, and keep questioning both yourself and the code and opinions of others that you read about. Understanding core principals around architectural design patterns is likely going to be important, and won't come to you instantaneously.
If you're doing work for a client, please use a framework. You get improved maintainability out of the box - other software programmers now or down the line will generally have a much easier time working on a preexisting framework with specific standards, structures, and documentation, rather than anyone's homemade code.
Security-wise, please choose the framework. While learning about security is good, perhaps by trying to write your own code, using a framework is not only easier, but much more appropriate and safer. A proven framework will generally be written and audited by people that have a lot more experience than you and notably a better eye for security.
A small team or individual writing home-grown code is much more prone to forgetting or not knowing or incorrectly attempting to handle security issues.
Security is easy to screw up for everyone. Things slip through the cracks, this happens to the best of us. So don't take chances. Rather than writing their own code, even professional software engineers will generally leave important security implementations, e.g. password hashing, to well-tested open source solutions.
Best of luck, and whatever you choose, make sure to have fun with it
.