How to create a new Laravel project in PhpStorm 2018.1? - laravel

How to create a new Laravel project in PhpStorm 2018.1 (in Ubuntu 16.04)?

It's just a five step process,
Just go to File -> New Project and in the dialog specify project name and folder, and – most importantly – choose type Composer Project.
Set Laravel project's folder & project name
Choose "composer.phar" option button & tick "Download composer.phar from getcomposer.org"
Select PHP Interpreter Version from drop down
Select package as "laravel/laravel" from list
Select PHP's version
Click on "Create" button. It will take time depending on your internet connection speed.
Congratulations, your new laravel project has been created.

That's not a PhpStorm specific question. To create a new project you need to have composer installed
Composer Homepage
and be sure it's appended to your path.
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc
To accept the changes, run
source ~/.bashrc
or logout and login again.
Then have a look at the Laravel documentation
Laravel
There are 2 possible ways:
Use composer directly
Use the Laravel installer
Both ways are fine, open the new created project in PhpStorm and you are good to go.

Related

Simplest way to get Laravel "Hello World" going?

I have programmed in PHP for many years, but it was before frameworks like Laravel. I am trying to understand Laravel now.
Can someone point me to something that explains the simplest possible way to get a Laravel "Hello World" app running. I know how to use composer. I have a Linux shared hosting account I can use for this.
I'd appreciate if someone could explain how I can get a simple Laravel example up and running, without having to install a ton of stuff on my PC.
Thanks.
Using composer download the latest version of laravel. Documentation is available at https://laravel.com/docs/5.8
composer create-project --prefer-dist laravel/laravel hello
After that go to that directory
cd hello
and run this command
php artisan server
Now open the browser and go to http://127.0.0.1:8000/
You will get a basic page that says Laravel and some links
Open hello with your code editor and open this file resources/views/welcome.blade.php
Write some content on the page and check http://127.0.0.1:8000/
You can watch the https://laracasts.com/series/laravel-from-scratch-2018 to get a basic idea.
(Optional) If you are in windows you can use https://laragon.org/ in that the installation is pretty easy.
To run this app on shared hosting.
First,
1) Create a folder Application on your file manager
2) Upload files to that folder. (Laravel files, installed via composer)
3) Move public folder files to /public_html/ if you want the site in root domain
4) open index.php file and edit these lines
require __DIR__.'/Application/vendor/autoload.php';
....
$app = require_once __DIR__.'/Application/bootstrap/app.php';

See the difference between a clean laravel install and my code

I have a laravel app in which I want to see the added/changed files
How can I compare my Laravel project to a clean Laravel installation? Is there some software that can achieve this or should I write a script?
I doubt theres something like that specifically for Laravel. However, what you can do is to use Version Control (git) to help if your plan is to compare these 2 projects (Fresh install vs Project)
https://git-scm.com/
I'd do the following steps:
Create a git repo
Place a fresh laravel install on the repo
git add . and create a commit
Replace the whole directory with the new project
View with git diff (SourceTree would help you)
Git diff would give you what files are changed (in regards to the fresh install) and what differs in code. Beware that since we're talking about a Laravel project with a lot of content and a fresh install, it will give a lot of files changed.

Laravel Error "Unable to load the "app" configuration file" after Windows file restore

Bad mistake this morning. I uninstalled WAMP Server which deleted the Wamp folder and all its projects.
I restored the wamp folder from backup. WAMP is up and running on upgraded PHP and settings as before, however:
Laravel projects won't start - getting blank whoops pages on any Laravel project. When I cd into any project folder and try to run php artisan, I get:
Unable to load the "app" configuration file.
The 'config/app.php' does indeed exist. And, all the restored files appear correct.
As a test, I installed a new Laravel project and it works correctly. I also am able to clone a project from a Git repo, npm update & composer install, and that works. So, I don't think the problem is with the WAMP stack.
I need some direction troubleshooting this. Thanks!
The problem is that Windows changes the case of some file names during restore. What a drag. There seems to be no reasonable answer except make the switch to Apple.
For example, in the Laravel config folder, Windows restored these files with proper case, App.php, Auth.php, Queue.php, and View.php. Everything else was left lowercase as they need to be.
Correcting the case of these files fixed the problem for now (until I find other mis-cased files).
Make sure this file exist
config/app.php

Can't install Laravel

I can not install Laravel. I am using xampp. here's what I get when I try and install it
If you want to create a Laravel application under the name Blog:
rm blog -r
laravel new blog
If you want to create a Laravel application under different name:
laravel new applicationname
(I assume you're very new to Laravel, so welcome! You can delete this question if you want to so it won't hurt your reputation, I'm already give it one thumbs up so it won't hurt that much :) )
The message says that the Laravel project is already created. If you want to create a new Laravel project you have to delete it first, or create it with a different name.
Laravel is designed to be installed into a fresh project directory. However, if for some reason you want to install Laravel into an existing non-empty directory, do the following.
In this example, we install Laravel into foo and then copy it into an existing project named bar
1) Create the new Laravel project:
$ laravel new foo
You should now see your two projects:
$ ls
foo/ bar/
2) Copy Laravel project files into bar/ and rerun Composer installation.
rsync -av --ignore-existing --exclude=vendor foo/ bar
cd bar/
composer install
Beware that this will not overwrite any files in case of name conflicts. If you have an existing composer.json, you will need to manually composer require all the Laravel dependencies. Similarly, if you have an existing .gitignore file, then you should manually merge the two.

Laravel installation

No existing questions are sufficiently basic to answer my problem. I am trying to install Laravel to try it out and have successfully installed Composer but all advice about installing Laravel itself seems to involve something called Git and a 'terminal' which I know nothing about. Can I not simply download a setup file and run it as for other apps?
Mike
Install Laravel Framework in Windows:
Created By : Chirag Shah
PHP version greater than 5.3.7 is required
Step 1: Download Laravel from: https://github.com/laravel/laravel/archive/master.zip
Step 2: Extract Laravel into the www folder for WAMP (http://www.wampserver.com)
Step 3: Download Composer from: https://getcomposer.org/Composer-Setup.exe
Step 4: Install Composer into the same directory php.exe is located
Step 5: Click on WAMP icon->PHP->PHP Extensions and enable: php_openssl, php_curl, php_socket
Step 6: Click on wamp icon->Apache->Apache Modules and enable ssl_module
Step 7: Enable openssl from all php.ini files
Step 8: Open cmd
Step 9: Change into the directory where you extracted Laravel e.g: cd C:\wamp\www\laravel
Step 10: Type the command: composer install
step 11: Copy and paste all \public\ folder files into WAMP's www folder
Step 12: Open bootstrap\paths.php and edit the line 'public' => DIR.'/../public', to 'public' => DIR.'/../www',
Installation completed.
Enjoy....
Yes you can, this is the link to the zip file:
https://github.com/laravel/laravel/archive/master.zip
But at some point you might need Git, so you better get along with it. :)
Hi sorry to let you know that laravel at some point requires you to handle a terminal. Git is not a necessary attribute for just a try out. Terminal is nothing to be scared of - its actually the command line which is referred to as the terminal.
You can get a lot of tutorials and help on how to use terminal effectively. And using the terminal solves you a lot of trouble too. If you are interested in learning and programming in laravel take an interest in studying the terminal too.
Steps to install 5.1 laravel in windows using wamp or xampp:
-> Step 1: install laravel composer (you can download it from https://getcomposer.org/)
-> Step 2: open command prompt then download and install laravel installer using composer by the following command:
composer global require "laravel/installer=~1.1"
-> Step 3: Right click on my computer then go advanced tab then environment variables and in system variable search for path -> and put the following code in the end of line after ;(semicolon) :
;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin;
-> Step 4: then go to wamp directory ie: e:wamp/www/ (i have installed wamp in E directory)
-> Step 5: open command prompt and select the current directory using following commands:
1. e:
2. cd www/laravel
-> Step 6: in command prompt run follow command:
laravel new blog
Now laravel project with name blog is installed on your local machine using wamp or xampp.
open http://localhost/laravel/blog/public in your browser.
on success you will see laravel 5 logo.
Enjoy with laravel installation.

Resources