Testing Symfony flex on Windows - php

I can't make composer working with flex receipe on a symfony4 project, on Windows.
Here is the complete process :
I installed PHP7.2 from http://windows.php.net/download#php-7.2 (VC15 x86 Non Thread Safe), PATH env is set. php.ini is created (from php.ini-development). PHP is working on windows (php -v).
I installed composer from the Composer-Setup.exe (https://getcomposer.org/download/). It changed the php.ini for me for activating some php extensions (openssl, etc).
I created a project with composer create-project symfony/skeleton sf4
I moved to sf4 dir : cd C:/sf4
I run Web Server : php -S 127.0.0.1:8000 -t public
It works when I browse locahost:8000
So I want to install the symfony twig bundle as a flex package : composer require twig
The error I get :
[InvalidArgumentException]
Could not find package twig.
Did you mean one of these?
twig/twig
slim/twig-view
latte/latte
twig/extensions
timber/timber
I tried with a local composer.phar inside the sf4 project :
cd C:/sf4
php composer.phar require twig
=> same error
Composer seems to ignore flex plugin, do you have any idea ? Thx !

see the answer of nicolas-grekas in the following link
you can continue using the symfony containers in this link, just look for the alias that flex used.
in your case twig for flex is "symfony / twig-bundle", run composer req symfony / twig-bundle.
salu2

Related

Symfony 4 - No route found after installation on Mac

I have tried to install the Symfony 4 on my Macbook Air by using Composer. I have used the below commands for installing and running Symfony application
composer create-project symfony/website-skeleton symfony4
cd symfony4
composer require server --dev
php bin/console server:run
And then tried to access the application in http://127.0.0.1:8000/. Below is the error message
Below image shows the error in which line and file
I am using PHP 7.2.3 and installed by using Homebrew. At the same time when I use the below command to install, Symfony welcome page appears without any error.
composer create-project symfony/skeleton symfony4
There is no default welcome page when you create new symfony flex application and there is an issue and a pull request already.
Everything is working fine you just don't have any pages.
Here you can read how to create a symfony page: https://symfony.com/doc/current/page_creation.html

symfony flex composer InvalidArgumentException

So I downloaded symfony 4 with help of this command
composer create-project symfony/skeleton my-project
Afterwards, from the project's directory I try to pull the symfony's flex profiler package using command
composer require profiler --dev
but composer is having issue. Like it wants to pull the package down the standard way and not by utilizing symfony flex
UPDATE: Issued at https://github.com/symfony/flex/issues/306
see the answer of nicolas-grekas in the following link
you can continue using the symfony containers in this link, just look for the alias that flex used.
in your case twig for flex is "symfony / twig-bundle", run composer req symfony / twig-bundle.
salu2

Not able to install symfony on windows

Hello I am trying to install symfony on Windows. I had follow the all require steps for it but it end up with below message.
[RuntimeException]
Symfony can't be installed because the downloaded package is corrupted.
To solve this issue, try executing this command again:
Symfony new demo 3.2.8
When i tried above command it says :
'symfony' is not recognized as an internal or external command,
operable program or batch file.
I have try to reinstall composer and Symfony package both but it does not resolve the issue. It stays the same issue again.
Please help me how can I install it on Windows.
You are required to make it run through PHP as its a script file.
This gets the installer (which it looks like you have already)
php -r "readfile('https://symfony.com/installer');" > symfony
Then php symfony new demo 3.2.8 (asuming if php is in path otherwise you have to specify the php.exe path too)
For the full details see http://symfony.com/doc/current/setup.html
Regards
forget about that installer use composer from command line
composer create-project symfony/framework-standard-edition my_project_name
BTW i don't know what server you are using (wamp/xamp etc), i recomending this
https://laragon.org/
it have composer and all tools that you need to start with symfony

Where to install Composer and Symfony

I am using Symfony2 on my MacBook in local. So I have Symfony2 installed, MAMP installed and composer installed. But not sure if I installed them where I should install it. Would be very nice to have an overall files and folder plans to do it properly.
Here where I install Symfony and where I have composer:
My symfony2 is here:
Applications/MAMP/htdocs/Symfony/
this file: composer.json is in Symfony
Applications/MAMP/htdocs/Symfony/composer.json
And composer.phar and again composer.json is in here:
username/MyWebSite/bin/composer/composer.phar
-------------------------------/path/composer.json
(where should I put my symfony file and my composer files? What should I change (configuration) so that my website still working on localhost if I change something?
Try to put composer.json and composer.phar at the root of your Symfony folder (Applications/MAMP/htdocs/Symfony/).
Then "php composer.phar update" in the Command Line Interface.

Installing Laravel

I am on a windows 8 machine and I'm trying to learn laravel. I copy and pasted my PHP folder from C:\xampp to C:\php, installed composer, ran composer install then composer create-project laravel/laravel learning-laravel. So far everything was created so I went into the directory and tried to use 'php artisan serve' and got the following error.
C:\Users\denni_000\learning-laravel>php artisan serve
Warning: require(C:\Users\denni_000\learning-laravel\bootstrap/../vendor/autoloa
d.php): failed to open stream: No such file or directory in C:\Users\denni_000\l
earning-laravel\bootstrap\autoload.php on line 17
Why you copied php folder
download composer install it.
download laravel latest version and store it on your xampp/htdocs/laravel
and run cmd with composer install command
For more follow install laravel on windows xampp
or Laravel 4.1 installation with composer in xampp
For windows Simply download Laragon which includes latest php 5.6.7, Apache, Mysql, Redis, Memcached an alternative to Xampp or Mamp with small size. Easy to install laravel and create project with auto create virtual host by it. Thank you.
U need to go to the directory where laravel is installed and run the following command.
composer update
Install Laravel 4.2 with composer:
sudo composer.phar create-project laravel/laravel project-directory-name 4.2 --prefer-dist
Here is a different way to setup laravel, may be you guys will like it
Step 1:
Clone https://github.com/laravel/laravel or you may download zip also.
Step 2:
Navigate to downloaded folder in command prompt and run composer install
Step 3:
open the folder and rename .env.example to .env and update the credentials mentioned in file.
Step 4:
After these steps if you navigate to the directory from web-server it will cause an error No supported encrypter found. The cipher and / or key length are invalid. to fix this just run php artisan key:generate
Done!
Hope you guys like this way :)
You need to install all the laravel required dependency.
To do that, you need to tell composer to install everything needed.
Below is the command to use to install that's required in laravel composer.json.
composer install
Follow the installation guide from Laravel
Install Composer:
Like Laravel.com says: "Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable can be located by your system."
Type the following statement in the command line:
composer global require "laravel/installer=~1.1"
Create a fresh Laravel project in a specified directory with the "laravel new" command:
laravel new blog
You can also create a Laravel project using composer, like such:
composer create-project laravel/laravel --prefer-dist
If you want to learn laravel I seriously recommend you use laravel homestead with vagrant.
For this you need to:
Install virtualbox.
Install vagrant.
Install git.
Install ssh.exe (Download msysgit and copy the content of bin folder to git bin folder).
Install Homestead on Vagrant (Follow the steps on laravel/homestead documentation page).
Install Laravel on Homestead (Follow the steps on laravel/installation documentation page).
This method apply to Windows, Linux or Mac, only change the step 4 on linux or mac.

Categories