Tidying up folder structure for libraries added with composer - configuration

Starting with a default installation of SilverStripe (using composer), I have the folders framework, cms, mysite, etc.
Using composer I then added some additional code, such as userforms with the command:
composer require silverstripe/userforms
This created the folder userforms in the root of my site.
However, to manage my code more easily, it would be nicer if all modules added by composer were in a subfolder together. This answer indicates how a default vendor-dir directory can be specified using the composer.json file.
There is already a vendor folder in existence (if I understand correctly, this is used by composer). Is it ok to use the vendor folder as the default vendor-dir setting, or would it be better to create a new folder instead?
Also, what do I need to do to move existing folders (such as userforms) into the appropriate sub-folder?

This behaviour is specified by type. The packages with "type": "library" will be placed into vendor folder.
This is how the framework was designed, it expects the files to be located where they are now. It uses legacy code and is unable to make use of Composer autoloading.

Related

PhpStorm with common library folder

Here is how our server is set up:
/var/www/vhosts:
composer.json
library/
vendor/
website1/
website2/
website3...
We think of the whole server as one project. Today I only care about website1 (and composer.json, library, vendor). But the base URL is going to be website1.com.
How do I set that up? Is my project root /var/www/vhosts or /var/www/vhosts/website1?

yii2 - All Files and Folders permissions are messed up. What should be the permissions of yii2 framework's directory hierarchy

I moved the complete yii2 installation from one server to another with the help of FileZilla. Sadly, Filezilla don't keep the file permissions by default, and now I'm facing issues with file / directory permissions. I would like to know what's the file permissions for different directories and files in the yii2 directory hierarchy.
You should not transfer the project this way.
Currently it's the era of version control (especially Git) and Composer.
Once you created you project locally and put it under version control, you push it to your main repository and then deploy it to production server.
No need to use Filezilla or something like that.
If your hoster limits you in that, it's better to switch to another one.
In your current situation comparing and setting permissions manually can be very tidious, some of the permissions are set during init command.
So I recommend to deploy it again using version control and Composer instead of struggling with manual permissions setting.
But just in case, I checked production server, most of the folder permissions are 0755, for files - 0644. Folders like runtime, assets have 0777 permissions and set with init command as I mentioned above.
Locally I use Vagrant and pretty much everything here has 0777 permission.

Padrino app not aware of its own root path

I have a Padrino app which doesn't seem to be aware of its own root path. The app works fine, but when I try to require a file I wrote and put into the models folder, it says it cannot find it. The file is required from within another file in the models folder: DvdActor.rb. I can use any of these paths and it won't find it:
/app/models/file.rb
file.rb
models/file.rb
app/models/fie.rb
...
It will only find it if I use:
"#{Padrino.root}/app/models/file.rb"
Furthermore, the Thnking Sphinx gem will also have problems writing its configuration file or indexing (if I hardcode the path to the config file).
And when I have Padrino generate a Model, it will create a new model folder in the root folder insted of in the app folder itself.
I could recreate my app from scratch and copy the files over but I already have Heroku and git setup, etc. and don't want to recreate all this (sometimes simply copying the files over doesn't work properly).
Is there a way to reset this?

How would I add existing folders to a project in Eclipse?

I don't know how to add the this into my existing project.
The only thing I learned so far was adding jar files, not those types of folders. How would I add the source to my project? Are they packages?
Steps I've done:
Download
Extract into a separate folder
I think I might be over thinking it.
If I interpret the download link right, you are downloading the sources of a lib.
If you are not already using that library, you should download this instead and add it to the project's build path. Copy it to your folder, where you have your other libs placed and add it via right click menu Build Path *-->* Add to Build Path. Afterwards you can use the classes from that library.
If you already have that lib in your project, I guess you want to attach the sources to the lib. Therefore you need to go into your project's build path and edit the jar, and configure there, where the zip file (which does not need to be extracted) with the sources is. There is a detailed description for linking sources to jar files in the eclipse documentation.
For further details on build path configuration you could read in the eclipse documentation.

Where are Kohana config files?

I've just installed Kohana 3.0.4.2 and I have run the index.php file successfully. According to the documentation, the next step is to edit the config files in the application/config folder. I have that folder but there are no files in it! I downloaded the package again to make sure it wasn't corrupted, but the same problem exists. Why is the application/config folder empty?
You're probably looking at outdated (2.*) documentation. The only config file to edit after an install is application/bootstrap.php. There is some configuration in index.php, but you really shouldn't be touching that unless you want to change the directories things are stored in.
The config folder is used for config files of your custom classes. Since you obviously don't have any in an empty project, the folder is empty. You can see an example of them in use by looking at system/config, where the config files for some of the system classes lie.
As of now, the best docs are the unofficial Kohana wiki. There's also the official docs, but they're a work in progress.
One of the best things about Kohana 3 is that it's extensible and really modular.
In you case, there are no config files by default, you only have the clean framework with couple of modules ( you'll find them in the /modules folder ). Every modul has pretty much the same hierarchy as application folder, so you'll probably find the default config files there.
If you need database config, go to /modules/database/config/ and you'll find the default one, copy it to application/config and you've overwriten the default one from being used ( Kohana autoload just works this way; first looks for files in application folder, then the loaded modules folder(s), and the system (framework) folder is the last.