Running composer installation in a Symfony 3.2 project on a machine that shares 2 environments - symfony

I have in the same server in 2 differents directories, like this:
/var/www/pre.myproject.com/
/var/www/myproject.com/
pre.myproject.com is a full copy from production myproject.com
When I am trying to run the command composer install inside the folder /var/www/pre.myproject.com/ with this:
composer install --no-dev --optimize-autoloader
I see the following errors:
Cannot create cache directory /var/www/myproject.com/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /var/www/myproject.com/.composer/cache/files/, or directory is not writable.Proceeding without cache
Why is it trying to make changes in myproject.com if I am currently at pre.myproject.com?
What files should I change in my folder pre.myproject.com to enable a new environment in Symfony3? And so the composer can install correctly for this environment and within this directory?

What you trying to do is having a new installation of an existing Symfony project with an existing composer.json file containing all your dependencies.
What you should do is not composer install but composer update as the composer.json file should already exist, it'll just read it and download the dependencies packages
composer update :
The update command reads the composer.json file from the current
directory, processes it, and updates, removes or installs all the
dependencies.
This is what I am using on my production server when I import a new feature from my development branch.
Edit
You should add --no-cache option to bypass the cache.

Related

How to Install Kint Globally Drupal - Without Devel Module

I was trying to setup an easy way to debug the Lando Drupal installations using Kint module. But I don't want to install the Devel and Devel Kint Extras modules in each Installations.
What I have initially done is installed the Kint globally in my local.
composer global require kint-php/kint
But it is not possible to access the functions inside a Lando installation by requiring the global autoload file to the settings.local.php
include_once('/home/username/.composer/vendor/autoload.php');
The same is working on local Drupal installation, but not inside Lando installations.
Yes, it is possible to install PHP Kint Library globally for Drupal Projects without Devel Module installed.
Install Kint Globally
Install PHP Kint Library globally.
composer global require kint-php/kint
Then copy the file path where the composer globally installed. If you are unable to find where the composer global directory, use the below command.
composer config --list --global
And figure out the [home] directory from the list.
Now go to your settings.local.php in your drupal project. And include the global autoload file as below.
include_once('/var/www/.composer/vendor/autoload.php');
if (class_exists('Kint')) {
Kint::$depth_limit = 4;
}
Change the /var/www/.composer/ to your home directory.
For example: /home/adharsh/.config/composer/vendor/autoload.php
Usually the settings.local.php file is gitignored, so there will be no change for your code base and the Kint is now ready to use.
Yeah, its ready to use.
Go to the file you want to debug and use d() function to debug.
Example: d($variable);
More functions are available in the Kint documentation.
Install in Lando
NOTE: If you are a lando user, you have to ssh (lando ssh) into lando and globally install Kint. The composer global directory will be in /var/www/.composer . You may need to reinstall the Kint globally if you are rebuilding Lando.
But you can add the run command in lando file to install the composer on lando build.
services:
appserver:
type: 'php:7.4'
run:
- "cd $LANDO_MOUNT && wget https://getcomposer.org/download/2.3.9/composer.phar"
- "chmod +x composer.phar"
- "php composer.phar install -n"
- "php composer.phar global require kint-php/kint"
- "rm composer.phar"
Replace the https://getcomposer.org/download/2.3.9/composer.phar composer download link with you specific composer version from getcomposer and save the lando file.

How to install the module in alfresco?

Help install the eisenvault-esign module.
I tried to install files
"eisenvault-esign/ev-esign-repo/target/ev-esign-repo-1.0-SNAPSHOT.amp"
in the "\amps" folder
and
"eisenvault-esign/ev-esign-share/target/ev-esign-share-1.0-SNAPSHOT.amp"
in the "\amps_share" folder
But when you start apply_amps.bat module is not installed.
Alfresco version 5.2
Below is the execution process.
When you run apply_amps.sh you need to pass in the -force flag because the module you are trying to install overwrites shipped libraries as indicated by your console screenshot.
You should also file an issue with the owner of that project to ask them to adjust their AMPs so that they can be installed without the force flag.

ignore dev dependencies in php composer

I have developed a composer laravel based project that I need to install on a remote production server. The problem is I have limited permission/ access so my option is to "archive" the package( using composer archive) and unpack on the production.
What folders do I need to archive and how can I ignore the dev dependencies of the package as well as vendor dev dependencies?
composer archive is likely not to help you, because this command creates an archive of a defined version of a package.
You probably want to upload the whole working application, and not only one package. You should create a little script that will create the archive file for you, which should do:
checkout the application from the repository in a new directory
run composer install --no-dev to install all required dependencies without dev-dependencies
optionally delete files that are not necessary on the server, like documentation, the .git folder, and other stuff
create the archive file from all these files
optionally upload that archive to the target server and unarchive there
optionally check basic functions and switch to the new uploaded version on the server

Composer misses to install certain files (app/console, AutoLoader.php, app_dev.php, etc.)

I am developing a web application with Symfony 2. The code of my own bundle that forms the heart of my application and some configurations files for application-wide settings are controlled by Git (mostly the directories, src/MyCompany/MyBundle, app/Resources/config, etc.) The rest is under control of Composer (the framework, 3rd party bundles, etc.)
Up to now, I ran a ./composer self-update && ./composer.phar update once in a while, pushed or fetched source code from the origin of my repository and everything has been working well.
Today, I started a new fresh working directory and experienced some odd problems.
I performed
git clone <my git repo url> www
cd www
composer.phar install
The composer.json is part of my repository, hence it normally suffices to excute Composer in order to install the framework and all required bundles to get a fully working copy of my web application.
But today, composer.phar install stopped prematurely complainig about missing files. Luckily, I still had my old working directory, so I could copy over the missing files manually, and restart composer.phar. I had to repeat these steps several times until I ended with a fully working application.
The files that were missing are
app/console
AutoLoader.php
app_dev.php
AppCache.php
I thought that these files are part of the Symfony framework and expected them to be installed by Composer. Fot this reason they are not under control of my revision control system.
I found this related question. The answer is very generic und not particularly helpful. All it says is that for example app/console should be included into revision control, because it is not installed by Composer (any longer) and that there is a change in the directory structure due to the transition from Symfony 2 to 3. But I know for sure that app/console was installed by Composer in the past. Hence, something changed.
This leads me to the following questions
Is there any complete, up-to-date and official documentation
what should be included in the repository
what should be in .gitignore
what is managed by Composer?
Is there any documentation how to do the transistion from the old directory structure to the new one in preperation of Symfony 3?
I thought I read all README.md, all release information and everything in "Living on the Edge" of the Symfony site, but somehow I missed this.
The clean way to install Symfony2 from scratch with composer, is to use the following command:
composer create-project symfony/framework-standard-edition my_project_name
This will ensure that all basic structures are created. After that, you can still insert your customisations from the previous project.
Then you can add everything – except app/config/parameters.yml as well as the contents of vendor/, app/cache and app/logs – to your repository.
About transitioning to SF3, I guess there’ll be an upgrade path as soon as SF3 is stable enough to create such a document.
1.1. that depends how you want people to be able to fetch your bundle
1.2. I share with you my own .gitignore: beware I use git for my own use to have a security for my files, not to allow people to get my bundle:
# Cache and logs (Symfony2)
/app/cache/*
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep
# Cache and logs (Symfony3)
/var/cache/*
/var/logs/*
!var/cache/.gitkeep
!var/logs/.gitkeep
# Parameters
/app/config/parameters.yml
/app/config/parameters.ini
# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
/vendor/
# Assets and user uploads
/web/bundles/
/web/uploads/
# PHPUnit
/app/phpunit.xml
/phpunit.xml
# Build data
/build/
# Composer PHAR
1.3. everything that is in composer.json

Composer "chmod(): No such file or directory" with bin directory

I am trying to install my Symfony2 app on koding.com
Trying to install my vendors via php composer.phar update, I run into the following issue, installing doctrine/orm:
Installing doctrine/orm (2.3.x-dev 4d9f24b)
Cloning 4d9f24b2eef3af3a3e76c773994c19bbb0706f88
[ErrorException]
chmod(): No such file or directory
I tried to debug with -v and found out that the following line is causing this issue:
composer.phar/src/Composer/Installer/LibraryInstaller.php:217
In there I see that this issue is related to the bin directory. I have set (S2 default) the bin-dir to "bin". The bin directory is also in place within my project, but somehow composer does not find it, when trying to change the chmod. I have used this setup on several windows machines and also on c9.io.
Issue resolved due to fix on github: https://github.com/composer/composer/issues/1270

Resources