I'm learning Laravel and they say in order to create a new laravel site you have to make your folders like this:
--webshop
--root
--laravel (contains the laravel files)
--assets (contains the css,fonts,img,js from the public folder of laravel)
--.htaccess
--favicon.ico
--index.php
--robots.txt
--web.config
So as you can see I cut the containers of public folder inside Laravel and paste them in the root directory. So now I want to start the project and make it live on the localhost using Artisan commands but I don't know in which folder I have to make it live... For example root directory or laravel directory inside of root or something else... So can u please help me!
No, that's wrong. install laravel by composer like this:
composer require --prefer-dist laravel/laravel mysite
from inside mysite start project by run the artisan command php artisan serve and enter in the browser the url 127.0.0.1:8000
more information here
Have you checked Wamp or Xampp if you're on Mac/Linux, it's a PHP local server with phpmyadmin if you want to test out with a local database. Also have you created your project with composer create-project --prefer-dist laravel/laravel nameofyourproject? It installs all the basic folders you need to start using laravel right away, you can then copy those files on Wampp/Lampp and use localhost.
Refer to the documentation here:https://laravel.com/docs/5.4
If you have composer installed, use:composer global require "laravel/installer"
Now, to create a new project simply run : laravel new ProjectName.
No need to create a directory structure on your own.
Related
I've seen answers for this question, but I'm still really confused, because answers say I need to be in my Laravel's project folder, which I thought I had created.
I'm trying to run the command php
php artisan horizon:install
This is the second step in the Laravel installation guide found here: https://laravel.com/docs/7.x/horizon#installation
My directory structure looks like this in my documents folder in Mac OS:
I've tried running the command in the RetimeWeb, vendor, bin, laravel and horizon folders. What am I doing wrong here? Where is an artisan folder supposed to be?
Laravel Horizon is dashboard for managing queues (jobs) in Laravel that supposed to be installed on top of Laravel project.
Based on your directory structure you installed Horizon from composer alone. Now you are trying to run command "php artisan horizon:install" but artisan is a tool from Laravel.
"horizon:install" supposed to copy all assets, configs etc to Laravel project - but again, you do not have any so there is not even where to copy it.
To summary.
Install Laravel.
Install Laravel Horizon.
Do cd until you're in the root folder of your project and run the command again. artisan file is in the root folder of a laravel project
I'm using Google App engine to deploy a PHP project.
I'm using the following file structure.
public/project_files_here_composer.json_here_too
private/some_private_files
app.yaml
In app.yaml I set the public folder to be the web root directory that contains the index.php .
When I deploy this with google app deploy , my composer dependencies are not installed.
How to tell Google App Engine to install my dependencies inside the the public/ folder (using the composer.json in the public folder) ?
I've been searching on the documentation for the gcloud app deploy operation and the app.yaml file and I didn't manage to find any reference to what you intend to do. Trying to reproduce your scenario, what I did was to create a soft link in the app's root directory that pointed to the composer file in another folder, but it didn't work.
What did work was creating a hard link in the app's root folder with the following command:
ln public/composer.json composer.json
Regardless, when I made the gcloud app deploy command, it said that it was uploading 0 files (which is kinda true), but when I looked on the source from the Console, the file was there and the dependencies were installed, so it works.
If you don't want to create a hard link, you should just create a script that copies the file, deploys and removes it. Something in the lines of:
#!/bin/bash
cp public/composer.json .
gcloud app deploy
rm composer.json
If none of these works for you, you should just move the composer.json to the app's root directory.
I have an existing Laravel project I want to clone from GitHub.
I normally run Laravel on Homestead/Vagrant.
But this time I need to run it on Mamp.
I already cloned the project into my htdocs folder.
When I click to see my website, I see Index of/ then all the files.
Index of/
.env.example
.git/
.gitattributes
.gitignore
.phpintel/
app/
artisan
bootstrap/
composer.json
composer.lock
config/
database/
gulpfile.js
package.json
phpunit.xml
public/
readme.md
resources/
scratch3.php
server.php
storage/
tests/
What do I need to do/change/configure so my Laravel website works properly.
I'm on a Mac.
According to my experience, there are some steps for setting up an existing Laravel project as follows:
Install PHP and Composer
In your Laravel dir, run composer install
Then copy .env.example file to .env
Open .env and change a database connection information and save file
Generate the application key by using a command php artisan key:generate
Run a migration if exist by using a command php artisan migrate
Then run composer dump-autoload
Finally, start your project with command php artisan serve or create a shortcut in a public directory or Mamp and link it to public folder of your Laravel project.
Hope this helps, any comment is welcome.
if you click your website and you see your root you probably need to configure your settings a bit, maybe this will help
How to get htaccess to work on MAMP
How to setup existing laravel 5 project and there database in Ubuntu 14.04 using xampp?
Some of things you need to consider for new setup. If you have setup git repo then
You can just pull from git If not copy/paste all folders except vendor, node_modules.
Use composer install to make vendor folder
Use npm install to make node_modules folder if you already using
Use php artisan migrate to make database structure
Use php artisan db:seed if you set any seeding to fill tables data
Use php artisan key:generate to make security.
Create/Update .env file to make work configuration from environment
Now you have to point your domain with root folder of laravel you created here.
I am new to Laravel and PHP programming. I am building a web application using laravel framework. When I create project using composer create-project it creates laravel files inside the laravel folder and I move all the files out of laravel folder and delete the empty laravel folder as belo.
-root folder
--app
--bootstrap
--config
--database
--public
-----------
After, I pushed the project to github and clone it from another computer and to add laravel files I execute composer install. Now laravel framework files are created inside a laravel folder instead of root directory.
-root folder
--app
--bootstrap
--config
--database
--public
--laravel
----app
----bootstrap
----config
----database
----public
How can I change the location, composer create the laravel framework files?
If you want to install laravel with composer then you should follow bellow this way:
Firstly install Composer according to your operating system.And then if you use xampp then create a project folder or run a command composer create-project --prefer-dist laravel/laravel blog this will create a root folder and a sub-folder named laravel.
Your problem is that when you secondly clone git form github that time you mixed up the main root folder that's why its duplicated.
I think you should re-install again according the given procedure.Hope this will solve your problem.
Another way: if in your pc have installed composer then you just clone the git and after that in the root folder (cloned git folder) run the command composer update.It should solve your problem.
Tricks: For opening root folder with command for windows operating system. Press select the root folder and Ctrl + Shift + right button of mouse then click the options Open command window here .
LARAVEL DOC.
Thanks.
Use this to create Laravel project
composer create-project laravel/laravel YourProjectName