Satis Installation & Usage Guide for Beginner - php

I am new to Satis and I have tried with some tutorials such as https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md, http://code.tutsplus.com/tutorials/setting-up-a-local-mirror-for-composer-packages-with-satis--net-36726. But their explanation is very blur and incomplete.
This is what I have done.
I created new empty folder.
I run composer on that folder with the command composer create-project composer/satis --stability=dev
Now I see in the folder contain a folder called "satis". Inside that folder I see "bin", "src", "test", and "views" folder. Also, there are "compser.json" and "composer.lock" files.
So, what should I do now? I don't find any "satis.json" as on getcomposer.org tutorial. I really stuck there and don't know how to go forward. Why is it install a "Satis" folder in the folder I run? Does that mean, I have to install Satis on every project I need to use it? If you know how, please guide me.
Thanks.

It is your task to create that satis.json (or whatever name you like), fill it with the content you need, and then run the Satis command to create the repository.
The configuration has many variables that cannot be guessed beforehand, but that have to be filled by you because you know the details of how you are hosting the Satis repository.
You cannot break anything. Satis runs on it's own, creates some files, and then is finished. You can run it any amount of times to learn how to tweak it and make it work for you.

Related

How to copy vendor folder without having not found problem

I am using composer for my project and the entire project (even the vendor folder) is under git version control.
I know it may seem like a false action but I am in bandwidth deficit and I want to lower my bandwidth usage so I use this method to just copy the vendor folder.
When I push to to another repository and try to run php main.php from there It says that can not find the classes that I am using there.
I have managed to solve this problem by removing the whole vendor folder and re running composer i but it is not the behavior that I want. I want low bandwidth usage, I want to not wait for package installation.
I am using the same method for virtualenv of python apps and there is the same problem but that problem can be solved by just running virtualenv venv/ again so it corrects the new paths for the copied environment. How can I achieve the same behavior with composer? I dont see any info or command that can help me doing this.
Thanks in advance folks :)
Found the solution.
All you need to do is to remove one file and one folder:
rm -rf vendor/composer;
rm vendor/autoload.php;
Then run composer i and it will recreate the removed composer folder again and corrects the autoload files.
Have a nice day.

I can´t get all folders from my branch on GIT

I have a git project with one branch, I´m trying to clone all files in my local folder, but I can´t get the vendor folder. I would like to know if I can do it in other way to get also vendor class.
I´m running this:
git clone -b branch_name repo_URL
As I say, I don´t get one folder. What I need to do it to get all files?
PD: I can´t download a ZIP of the project.
You are not supposed to find that vendor folder in your repository. It would be useless redundancy.
In modern PHP projects, Composer is being used to manage external dependencies. When running composer update, it reads a file composer.json (which should be present in your repository) to find the most recent versions of the external packages to be used.
This creates a file composer.lock (which should also be in your repository) with the exact versions and commits that got downloaded. If at any later time someone (like you now) wants to recreate the contents of the vendor folder, they run composer install, which will try to get everything that was once downloaded.
So the first step for you is to download Composer, then run composer install (depending on your way of downloading, it might also be php composer.phar install or something close to that).
Reasons for composer install to fail is that dependencies can no longer be downloaded because they were removed from the internet, or that the project is too old and has too old versions of said files so that it does not run with current versions of Composer (although this should be very rare). In any case: If you encounter errors, ask a new question here with all the details, including the full output of the Composer command.
The reason why you don't get the vendor folder is because the vendor folder never went up to the git repository. If you see the .gitignore file, you will notice a :
/vendor
This tells git to ignore that folder and not to send it up to the git repository when you are pushing. There is no way for you to get that folder unless you find the original project before you pushed to the git.

Laravel 5 setup git repo for multiple developers

I've done lot of Google but still looking for solution, I'm working on Laravel5 project & wants to set it up with GitHub so multiple developer can work on it.
I've install Laravel & place in a repository on Git, Now I cloned it on my local machine & another developer also clone that repository in his machine and start working.
But issue is that, I have installed a package for HTML forms in my machine by composer & push my code to github. But when another developer pull the repository then his code is break because composer.js is updated for that package but actually that HTML package is not exists on his machine.
Can anyone help me to short out this, or is there any way so we ignore vendor folder, composer.js, app.php etc files during git Push?
To answer your question specifically, yes you could choose to ignore the vendor folder, composer.json and app.php files when you push to git. To do this, you would simply need to update your .gitignore file to reflect this. I.e, include these in your .gitignore:
/vendor
composer.json
/config/app.php
But then the next question is whether you really want to do this, as doing so would mean that changes you make - and any subsequent pushes - may not be compatible with work the other developer is doing down the track.
If you exclude the /vendor file and the /config/app.php file but leave the composer.json file in there now that the other developer already has a copy of the core files, the updated composer.json file they download would allow them to use composer install to update the project with the new package.
However all of this would be problematic for a developer who joins you down the track and doesn't have any of the current files.

what files to save to repository laravel - framework workflow

Let me just say this, I'm very new to composer and laravel.
I'm a long time cli fan, so I feel very comfy with composer. I've used npm, ruby gems etc, I see all the benefits to package managers.
Problem is, I'm saving entire laravel dir to my svn repository. It seems kinda redundant, especially vendor/bootstrap dirs.
I also find it uncomfortable to have vendor packages same in every laravel app directory on the same server, I'm kinda missing global gems thing from ruby.
How do you deal with this? Is it possible to have laravel like a shared library on server and then just have app/public directories in each project?
What files should be saved to repository? can composer handle all the dependency installation on production server? I see laravel files come with .gitignore files, where do I get svn version?
Much confusion atm in my head, hope to clear these up, so I can start actually writing code ^_^
First off, as far as I know, it is not easily possible to install laravel and it's dependencies globally. I wouldn't worry about that too much though since composer will cache them so it won't need to download everything for each project you set up.
Vendor directory
The vendor dir should definitely NOT be in your repository. I'm no SVN expert but according to this answer you can ignore directories by doing:
svn propset svn:ignore "vendor" .
Most SVN client software should have a similar function in a context menu or similar.
Deploy workflow
Ideally you checkout the repo on your production server and then run composer update to install all dependencies. If you don't have terminal access or have other troubles with that I recommend you download a fresh copy of your repo and run composer udpate. Then upload it to your server.

How to change a module's directory in Zend Framework 2 from /vendor to /module?

I want to customize a module that I installed using composer, and it is now in /vendor. When I copy it in /module directory, it won't be recognized anymore. Here is the file /vendor/composer/autoload_classmap.php, that I added this into it:
return array(
'myModule\\Module' => $vendorDir . '/../module/myModule/Module.php',
);
and after that it was working. But the problem is that whenever I run php comnposer.phar install that file is overwritten and again I have to update that file.
It seems that I am doing it wrong. So, What's the correct way to copy a module from vendor directory to module directory without loosing the functionality?
Regards
Edit: I want to fork the package and edit that fork.
Technically you can change where composer installs things to by specifying a vendor-dir in your app's composer.json, see: https://getcomposer.org/doc/04-schema.md#config But this would affect all composer-installed packages, including (presumably) your installation of Zend Framework itself.
I would recommend you just leave the vendor folder as-is and let Composer do its thing.
Edit: Okay, if you want to fork a project, it's best to make changes outside of your app. Checkout a copy of your fork, make any changes you need and commit them. Then run composer update in your app to bring in the updated version.
If you need to test your changes in the app before committing them, that can be a bit fiddly. Personally I would either symlink to the checkout elsewhere on the file system (temporarily, just to get it working). Or edit the files in vendor just to figure out what changes you need to make, then apply those changes again to your separate forked project. There may be a better way though.
I think you have to ask this question before trying to solve this problem:
Why i need to move this directory to another place?
Editing / modifying / moving any file or directory which located under the vendor folder or incorporating them to your awesome application's module/library/whatever folder by copy & paste is not a good practice. Composer won't like that.
To customize a library code, create your own module (or library) folder and properly extend composer-installed 3rd party library classes which needs to provide more or different functionality.

Categories