I am totaly new to composer !
Example; When using composer like composer require smarty/smarty I get all kinds of directorys installed like
But I only need smarty\libs and this smarty/libs should show up in an existing project direcory at webroot/project/smarty/libs.
In essence , can i specify this so composer just gets me what I need and puts it where I need it?
In essence , can i specify this so composer just gets me what I need and puts it where I need it?
Yes, but it requires additional configuration. What you already have (and what Composer is for):
Now in the default setup, Composer installs in the vendor directory. This directory is not part of your project commonly, therefore the name "vendor", and often excluded.
Now you want to import a directory of files into your project from the (in your project already configured) vendor folder.
This is basically a file-copying operation, consult your systems programming manual for the commands to recursively copy a directory of files (or consult the PHP manual for this).
Then adopt your project install instructions to (re-)create the target directory and copy over the files after the command to (re-)create the vendor folder (perhaps you're usingcomposer install
for that).
If you want to do this with Composer - which is possible - add a post-install event script to your project configuration (pre-autoload-dump can also be useful if you not only want to incorporate files but also you want to use the Composer autoloader for directories in your project, like the newly created folder by copying over vendor files).
Execute your setup instructions.
You then add your changes, review them and commit them to the project history.
Alternatively, you can also not ignore the whole vendor folder, just the part you are not interested in and then create a reference so that the project targets directory is in fact a relative symbolic link to the descendant directory of interest in vendor. This requires your system as well as your software configuration management software to support symbolic links (for example Git does). Composer itself can deal with both ways fine.
And here the take-away: You need the Smarty Composer dependency only at development time, therefore you add it to require-dev - not require.
If that does not give you enough isolation, you create another Composer project configuration and pass its name with the . You specify as well a non-standard Composer vendor directory name with that configuration and then do the operations there (this is perhaps the best to try it out in an existing project).
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.