Answer the question
In order to leave comments, you need to log in
Where can I find a good Composer tutorial?
I need to make an application that does NOT use frameworks but still uses Composer packages.
Somehow I've already assembled it there and it works, but I don't want to reinvent the wheel. I want to immediately organize the files somehow clearly. And that with namespaces and autoload, and, probably, even a router.
At the same time, I don’t even want to use Lumen. I want to do it from scratch.
Tell me a good little tutorial.
Those. I want to eventually get a kind of Laravel, but without views and everything else.
Answer the question
In order to leave comments, you need to log in
Composer is a package manager, you simply describe what dependencies you will have in your project. It also manages the autoloading of classes.
That is, in fact, at the minimum. Any project will have something like the following composer json structure
{
"name": "pomelchenko/project",
"type": "project",
"description": "description",
"minimum-stability": "stable",
"license": "proprietary",
"require": {
"php": "^7.4",
// тут зависимости для продакшена, когда будешь устанавливать приложение с флагом --no-dev
},
"require-dev": {
"phpunit/phpunit": "^9.5"
// тут зависимости для dev среды, с тестами и прочими инструментами которые несут вспомогательный смысл.
},
"autoload": {
"psr-4": {
"App\\": "src/"
// тут перечисляешь нэймспэйсы и пути до директорий с классами этих нэймспэйсов для приложения, которое будет на проде крутиться
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
// тут перечисляешь нэймспэйсы и пути до директорий с классами этих нэймспэйсов для вспомогательных инструментов, как правило для тестов
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question