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';
Related
I'm following this video tutorial (in spanish), which shows how to implement Jetstream with Bootstrap instead of Tailwinds: https://www.youtube.com/watch?v=Wt-OuBX6lEc&list=PLZ2ovOgdI-kWWS9aq8mfUDkJRfYib-SvF&index=31
The issue is this one: despite I've followed the steps strictly, I'm getting two important errors.
First of all, I should have a file named "app.css" into my folder "/public/css", but I don't. I don't have even a folder named 'css' into the 'public' directory, neither another lots of folders I should.
On the other hand, both my welcome view and my register view look ugly, like this:
The commands I've done are these ones:
Into:
leandro#leandro-Lenovo-B50-10:/var/www/html$
laravel new bootstrap --jet
cd bootstrap
Then,into:
leandro#leandro-Lenovo-B50-10:/var/www/html/bootstrap$
composer require nascent-africa/jetstrap --dev
php artisan jetstrap:swap livewire
npm install
npm run dev
php artisan migrate
sudo chmod -R 777 .
Also, the register view shows an error, unless I have activated VITE (with npm run dev).
Somewhere, I had to do a 'php artisan migrate:fresh', because a migration error.
I'm running the project into an Apache server.
I'm using:
Linux Mint 21 Vanessa
Apache/2.4.52 (Ubuntu)
PHP 8.2.1
Laravel v9.50.2
Does anyone have an idea of what's going wrong? It might be a conflict version, since I'm using Laravel 9, while the video is explained for Laravel 8.
I don't know if there's any additional information needed.
Thanks a lot!
I understand, that in order to contribute to the Shopware platform / core, I have to setup Shopware 6 using the development template.
I followed the steps at
https://github.com/shopware/platform#quickstart--installation
But only until
./psh.phar docker:start
I was thinking about installing via bin/console system:setup and bin/console system:install but it fails with
PHP Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException:
Unable to read the "/home/projects/shopware-dev-bd/bin/../.env" environment file. in
/home/projects/shopware-dev-bd/vendor/symfony/dotenv/Dotenv.php:567
Is there an easy way to create the .env? Do I have to copy it manually?
It is recommended now to use the platform repository directly for setting up development installations.
Just clone directly from shopware/platform
composer install
bin/console system:setup to create the .env file
composer run setup
optionally bin/console framework:demodata if you need demo data
Addition to the accepted answer:
While in the development template there was psr.phar to manage things like building the admin theme, and in production template there is bin/build-administration.sh none of those are there in the method described by #dneustadt.
Instead this is managed by composer scripts which are defined in the composer.json
For example admin JS is build using
composer run build:js:admin
Some guy made a site with laravel 5.6 and we at a different place need to change just some tags and the CSS, I have a git of the site but "vendor, .env" and many files that are also missing in the git, how can I open the site in my computer to adjust the style sheets I have no database backup and also installed laravel 5.6 and try to paste de missing files but there are still many errors.
Altough the original programmers excluded some files in the git repo using the ignoregit file I created a new laravel 5.6 project and copied the missing files to my original app folder, imported the missing packages using composer and finally used artisan to migrate the database using "php artisan migrate"
Installing Composer locally puts a file named composer in your directory. I have taken to copying this file into each of my projects that uses Composer, so that I can run php composer in each folder.
Since this results in a lot of needlessly-repeated code, I want to refactor the composer file into something minimal. The most logical solution would be to refer to a class that resides in the vendor folder. Why is there so much code in the composer file anyway? I'd prefer not to put the code into my own libraries if I don't have to.
For comparison, here's a sample of code in a typical phpunit file:
require_once 'my_bootstrap.php';
spl_autoload_register(array(MyBootstrap::class,'autoload'));
// Do some other stuff here.
\PHPUnit_TextUI_Command::main();
I want to reduce the composer file in each project to something like this.
I do not want to install Composer globally. I want each project to be an environment unto itself and not have to instruct another developer to install anything other than PHP.
I'm new to using command line tools. I'm trying to setup laravel 5 on a mac.
Every time I try to install a new app, I'm getting the following error:
"Could not open input file: composer.phar"
I thought I had installed composer in the global bin. Any suggestions?
Problem is you didnt move your .phar file to your path
check this link Laravel document
or Laravel official video
its will help you