As not to "reinvent the wheel" and to use ready decisions?

I am an aspiring conver. php. Now take various projects for bespoke systems, etc.
I realized that I was tired many times to write the same thing. The choice was either to learn a cms, or a thread of the framework. I understand with cms, such as WordPress, there's a bunch of ready solutions as plugins and themes, and if that's not enough, just "edit" the plugin or theme and everything will be as planned by the customer.
But now I have a question with frameworks, they provide ready-made solutions, or the need to connect. I've never heard of popular php libraries. From js is jquery, and php?
For example, such a commonplace as form validation: I have my own achievements and I can use them, but they are far from ideal. Is there such a tried and tested solution in the frameworks, they give something other than "frame"?
And why is there no popular libraries for php?
Please do not throw stones, I often Google, but then on this question in mind the puzzle is not assembled.
I would be grateful for any answers and advice, thank you)
July 8th 19 at 11:21
5 answers
July 8th 19 at 11:23
Solution
Actually https://packagist.org/ just did a collection of "library" for PHP.
Read about Composer and how to use it.

Frameworks give frame + basic functionality (some more, some less) and then on this basis, build your application.
Got it, thanks, I will study! - Davonte.Renner commented on July 8th 19 at 11:26
July 8th 19 at 11:25
Solution
From js is jquery, and php?

Framework - Yii2, Laravel and microframework.

But now I have a question with frameworks, they provide ready-made solutions, or the need to connect.

Framework - "the complex" ready-made solutions, micro framework - framework for a narrow range of tasks jQuery rather micro framework, and there is a library, for even more narrow circle.
Thanks for help, now became clearer. - Davonte.Renner commented on July 8th 19 at 11:28
jQuery is a library. - Davonte.Renner commented on July 8th 19 at 11:31
: I have it on VPS micro framework! - nickolas commented on July 8th 19 at 11:34
July 8th 19 at 11:27
Solution
July 8th 19 at 11:29
Solution
Symfony components are a very good set of libraries. It is used in such framewrok as symfony =) , laravel, silex micro framework, drupal cms and more. But to connect all this stuff into the project, as said above, you can use composer
Thank you) - Davonte.Renner commented on July 8th 19 at 11:32
July 8th 19 at 11:31
Solution
From js is jquery, and php?

HttpFoundation is to say the standard for processing requests. Used Symfony, Laravel, Silex, and still a lot of where.
Doctrine - in my experience it's the best system to work with the database. If you haven't watched it - strongly recommend. A system implementing ActiveRecord (if your project isn't for a couple of days) - better not use why - see here.
Monolog is a logging library is almost unique in terms of functionality.
Symfony Console Component is a very flexible component for implementation of console applications.

For example, such a commonplace as form validation: I have my own achievements and I can use them, but they are far from ideal.

Different cases require different solutions. In the case of high performance requirements, testability and security is often the best option like this:

/**
 * @Route("/profile/{id}", name="getProfile")
 * @Method({"GET"})
 * @param Request $request
 * @return JsonResponse
*/
public function getProfileAction(Request $request): JsonResponse
{
 try {
 $id = $request->attributes->get('id');

 if (is_null($id)) {
 return new JsonResponse("Param 'id' is required", JsonResponse::HTTP_BAD_REQUEST);
 } elseif (!is_string($id)) {
 return new JsonResponse("Param 'id' must be string", JsonResponse::HTTP_BAD_REQUEST);
 } elseif (!ctype_digit($id)) {
 return new JsonResponse("Param 'id' must be digit", JsonResponse::HTTP_BAD_REQUEST);
}

 // Business logic here
 return new JsonResponse();
 } catch (\Throwable $exception) {
 return new JsonResponse($exception->getMessage(), JsonResponse::HTTP_BAD_REQUEST);
}
}


Yes, it turns out a LOT of code, but this approach is very flexible and productive. There is an alternative using the library of ko-ko-ko/php-assert

try {
 $id = $request->attributes->get('id');
 Assert::assert($id, 'id')->notNull()->string()->digit();
} catch (\Throwable $exception) {
 return new JsonResponse($exception->getMessage(), JsonResponse::HTTP_BAD_REQUEST);
}
try {
 // Business logic here
 return new JsonResponse();
} catch (\Throwable $exception) {
 return new JsonResponse($exception->getMessage(), JsonResponse::HTTP_BAD_REQUEST);
}


Is there such a tried and tested solution in the frameworks, they give something other than "frame"?

There is, in almost every framework its decisions with its pluses and minuses.

And why is there no popular libraries for php?

see The beginning of my answer, there is a list of popular libraries.
Thank you! - Davonte.Renner commented on July 8th 19 at 11:34

Find more questions by tags PHP