Cloning a Laravel project into VSCode - php

I am trying to clone a Laravel project into VSCode and run the project on a local server. I have imported Remote - WSL, but it won't let me set up a composer. I get: this error message when using php command in the terminal
I don't know what to do from here. Is there any other way to simply clone a project?

A popular option is to use a pre-configured program like MAMP / WAMP / XAMP which gives you the stack you need to run php code locally.
Alternatively you can set up you local environment for php and solve the error you are getting...
The error suggests you need to install php globally on your system :
https://www.php.net/manual/en/install.windows.php
https://www.php.net/manual/en/install.macosx.php
And to install composer:
https://www.hostinger.co.uk/tutorials/how-to-install-composer

Related

Twig_Error_Runtime ; the "core" extension is not enabled ; symfony

I've inherited a Symfony/PHP web app codebase with zero documentation. I'm a nodejs dev so you can image the fun...! Anyway I'm getting there, my focus atm is to be able to run the project locally.
Here's the Symfony version:
Symfony version 2.7.16 - app/dev/debug
I've installed packages via composer install.
I can start the web app locally via CLI:
php app/console server:run
Server running on http://127.0.0.1:8000
Quit the server with CONTROL-C.
However when I try to access this URL I'm seeing the following error in browser. Have google'd around but couldn't work it out so am hoping someone here can point me in the right direction.
I think this is due to trying to run a new version of twig on an old version of Symfony
as you can see here: https://github.com/symfony/symfony/issues/20284
They mention something similar, perhaps try to include an older version of twig in composer?
composer require twig/twig 1.23

Browser Testing on AppVeyor using Laravel Dusk

I've been trying to set up my CI environment on AppVeyor since I need SQL Server. I can't seem to get laravel dusk working with it. I've managed to
Install PHP
Setup SQL Server 2012
Install Composer and all the packages
Install all my npm packages
Install the PDO SQLSRV drivers
and run a small script to create the .env file for testing but when I finally run
php artisan dusk
there's like 4 errors and 1 failure out of my 5 assertions
Here's an image of the tests failing: https://i.gyazo.com/98f3bc4ae979793eb4af62e97d90080d.png
The tests work on my local machine and I'm trying to automate it. I have no idea how to access my app while it's being tested so I've just put a localhost in the APP_URL of my environment configuration file(Laravel specific).
I'm trying to figure out how to get browser testing working on it. I've also installed chrome for chromedriver to be used in Dusk. Any help would be appreciated

AdminLTE & Laravel installation error with XAMPP

I am having troubles installing Laravel with the AdminLTE onto my local XAMPP server. I am trying to install this package:
https://learninglaravel.net/adminlte-template-laravel-5-package
here which requires me to install latest laravel
The install is done via composer with the following command:
composer global require "acacha/adminlte-laravel-installer=~2.0"
This seems to work fine.
The problem occurs when trying to create my new project via
laravel new laravel-with-admin-lte
which returns a
laravel is not recognized as an internal or external command.
Naturally I had a look at my Windows 10 Environment Variables and found that Path is correctly defined as: %USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Users\MyUsername\AppData\Roaming\Composer\vendor\bin.
Inside the \vendor\bin directory I see this:
If I rename those two files to laravel only, and then run the laravel new command, I receive a command "new" is not defined error.
No clue anymore what to do, can someone help please?
Thanks,
A2k

cannot run 'symfony' command on windows

I came from frontend stack so I can misanderstand something when I'm learning symfony3.
I downloaded Symfony according to documentation with:
php -r "readfile('https://symfony.com/installer');" > symfony
To make php command available i added some values to the enviroment PATH variable (according to this tutorial: https://seiler.it/installing-symfony-framework-into-xampp-for-windows/ - step 2.3) like this:
c:\xampp\mysql\bin;c:\xampp\php;c:\xampp\php\PEAR;C:\xampp\php\symfony
As you see I'm using xampp for PHP development. I added that last, because i copied that downloaded symfony file to c:\xampp\php\symfony directory.
OK, now if i want to use symfony command, like
symfony new project
I need to go to directory where there is that symfony file and add 'php' before, like
php symfony new project
Because simple 'symfony new project' doesn't work (error msg tells about that command isn't known by Windows). How can i fix it?
In frontend there is something like npm (node package manager) with which you can install library/tool locally in directory or globally (to run it in terminal from any place on the computer). Is there is any equivalent in PHP development? I tried to install this by pear (from mentioned tutorial in step 7), but it installed me symfony 1.x version (and error of running that command was that there is no task like 'new') and i want to learn 3, not 1.
I tried to get composer, but i don't see where can i install there symfony globally.
So, how to run symfony globally? What am I missing?
From this doc:
In Windows, move the symfony file to a directory that's included in the PATH environment variable to create the global command or move it to any other directory convenient for you
idea
Install and use Git Bash. Gives you more futures then the windows CLI.
Performance
To run a ten times more fast environment for Symfony i prefer a Linux OS.

bash: laravel: command not found

I am Using my own Machine Kali Linux 2.0 Debian x64 . Now, i have Installed Laravel in my directory structure like
/opt/lampp/htdocs/learning-larvel/
Inside the Learning-laravel folder i have Installed my Laravel files, and also i installed composer. So when i go to http://127.0.0.1/learning-laravel/public . I see a See a White Screen and in Between it is written "Laravel 5", which means the Laravel GUI Setup is fine.
Now, to create a new file for Laravel, when i open my Terminal and type
laravel new xyz
then it gives me a error which says bash: laravel: command not found
Now, how can i fix the error.. I have researched about it by setting PATH to bashrc. But i am not getting it fixed right. Additionally when i type in my command composer -version then also it says bash: composer: command not found but i have Installed composer on the folder learning-laravel itself.
I could also see files like composer.phar there in /opt/lampp/htdocs/learning-larvel/
Any help would be extremely thankful.
As the composer official getting started page points out:
There are in short, two ways to install Composer. Locally as part of
your project, or globally as a system wide executable.
if you wanna do composer -- or laravel -- in command line, you wanna install them globally.
Check out the following links:
https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
https://laravel.com/docs/4.2#install-laravel
I encountered the same problem. Apparently, the composer exists in path ~/.config/composer/vendor/bin when running as super user. Therefore, replacing the paths which were described above by this, and it should work. Hope it helps.

Categories