Contact

Blogs

Take a look at the things that interest us.

Building laravel jetstream project

Wesley Wesley 3 years

In this post we are going to set up a new Laravel project for Laravel Jetstream.

Requirements

  • PHP 7.3 or higher
  • Composer
  • Apache/nginx webserver

Step 1: Install Laravel

Download the Laravel installer using Composer.

composer global require laravel/installer

Now you can create your first Laravel project.

laravel new blog --jet
Output
    |     |         |
    |,---.|--- ,---.|--- ,---.,---.,---.,-.-.
    ||---'|    `---.|    |    |---',---|| | |
`---'`---'`---'`---'`---'`    `---'`---^` ' '

Which Jetstream stack do you prefer?
  [0] livewire
  [1] inertia
 > 1~
 Value "1~" is invalid 
Which Jetstream stack do you prefer?
  [0] livewire
  [1] inertia
 > 1

 Will your application use teams? (yes/no) [no]:
 > no

Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Creating a "laravel/laravel" project at "./events"
Installing laravel/laravel (v8.4.2)
  - Installing laravel/laravel (v8.4.2): Extracting archive
Created project in /var/www/html/events
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Lock file operations: 104 installs, 0 updates, 0 removals
  - Locking asm89/stack-cors (v2.0.2)
  - Locking brick/math (0.9.1)
  - Locking dnoegel/php-xdg-base-dir (v0.1.1)
  - Locking doctrine/inflector (2.0.3)
  - Locking doctrine/instantiator (1.4.0)
  - Locking doctrine/lexer (1.2.1)
  - Locking dragonmantank/cron-expression (v3.0.2)
  - Locking egulias/email-validator (2.1.24)
  - Locking facade/flare-client-php (1.3.7)
  - Locking facade/ignition (2.5.2)
  - Locking facade/ignition-contracts (1.0.2)
  - Locking fakerphp/faker (v1.12.0)
  - Locking fideloper/proxy (4.4.1)
  - Locking filp/whoops (2.9.1)
  - Locking fruitcake/laravel-cors (v2.0.3)
  - Locking graham-campbell/result-type (v1.0.1)
  - Locking guzzlehttp/guzzle (7.2.0)
  - Locking guzzlehttp/promises (1.4.0)
  - Locking guzzlehttp/psr7 (1.7.0)
  - Locking hamcrest/hamcrest-php (v2.0.1)
  - Locking laravel/framework (v8.15.0)
  - Locking laravel/tinker (v2.5.0)
  - Locking league/commonmark (1.5.7)
  - Locking league/flysystem (1.1.3)
  - Locking league/mime-type-detection (1.5.1)
  - Locking mockery/mockery (1.4.2)
  - Locking monolog/monolog (2.1.1)
  - Locking myclabs/deep-copy (1.10.2)
  - Locking nesbot/carbon (2.41.5)
  - Locking nikic/php-parser (v4.10.2)
  - Locking nunomaduro/collision (v5.1.0)
  - Locking opis/closure (3.6.1)
  - Locking phar-io/manifest (2.0.1)
  - Locking phar-io/version (3.0.2)
  - Locking phpdocumentor/reflection-common (2.2.0)
  - Locking phpdocumentor/reflection-docblock (5.2.2)
  - Locking phpdocumentor/type-resolver (1.4.0)
  - Locking phpoption/phpoption (1.7.5)
  - Locking phpspec/prophecy (1.12.1)
  - Locking phpunit/php-code-coverage (9.2.3)
  - Locking phpunit/php-file-iterator (3.0.5)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking phpunit/phpunit (9.4.3)
  - Locking psr/container (1.0.0)
  - Locking psr/event-dispatcher (1.0.0)
  - Locking psr/http-client (1.0.1)
  - Locking psr/http-message (1.0.1)
  - Locking psr/log (1.1.3)
  - Locking psr/simple-cache (1.0.1)
  - Locking psy/psysh (v0.10.4)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking ramsey/collection (1.1.1)
  - Locking ramsey/uuid (4.1.1)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.6)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.4)
  - Locking sebastian/environment (5.1.3)
  - Locking sebastian/exporter (4.0.3)
  - Locking sebastian/global-state (5.0.2)
  - Locking sebastian/lines-of-code (1.0.2)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.4)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (2.3.1)
  - Locking sebastian/version (3.0.2)
  - Locking swiftmailer/swiftmailer (v6.2.3)
  - Locking symfony/console (v5.1.8)
  - Locking symfony/css-selector (v5.1.8)
  - Locking symfony/deprecation-contracts (v2.2.0)
  - Locking symfony/error-handler (v5.1.8)
  - Locking symfony/event-dispatcher (v5.1.8)
  - Locking symfony/event-dispatcher-contracts (v2.2.0)
  - Locking symfony/finder (v5.1.8)
  - Locking symfony/http-client-contracts (v2.3.1)
  - Locking symfony/http-foundation (v5.1.8)
  - Locking symfony/http-kernel (v5.1.8)
  - Locking symfony/mime (v5.1.8)
  - Locking symfony/polyfill-ctype (v1.20.0)
  - Locking symfony/polyfill-iconv (v1.20.0)
  - Locking symfony/polyfill-intl-grapheme (v1.20.0)
  - Locking symfony/polyfill-intl-idn (v1.20.0)
  - Locking symfony/polyfill-intl-normalizer (v1.20.0)
  - Locking symfony/polyfill-mbstring (v1.20.0)
  - Locking symfony/polyfill-php72 (v1.20.0)
  - Locking symfony/polyfill-php73 (v1.20.0)
  - Locking symfony/polyfill-php80 (v1.20.0)
  - Locking symfony/process (v5.1.8)
  - Locking symfony/routing (v5.1.8)
  - Locking symfony/service-contracts (v2.2.0)
  - Locking symfony/string (v5.1.8)
  - Locking symfony/translation (v5.1.8)
  - Locking symfony/translation-contracts (v2.3.0)
  - Locking symfony/var-dumper (v5.1.8)
  - Locking theseer/tokenizer (1.2.0)
  - Locking tijsverkoyen/css-to-inline-styles (2.2.3)
  - Locking vlucas/phpdotenv (v5.2.0)
  - Locking voku/portable-ascii (1.5.6)
  - Locking webmozart/assert (1.9.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 104 installs, 0 updates, 0 removals
  - Installing doctrine/inflector (2.0.3): Extracting archive
  - Installing doctrine/lexer (1.2.1): Extracting archive
  - Installing dragonmantank/cron-expression (v3.0.2): Extracting archive
  - Installing symfony/polyfill-php80 (v1.20.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.20.0): Extracting archive
  - Installing symfony/var-dumper (v5.1.8): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.20.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.20.0): Extracting archive
  - Installing symfony/polyfill-ctype (v1.20.0): Extracting archive
  - Installing symfony/string (v5.1.8): Extracting archive
  - Installing psr/container (1.0.0): Extracting archive
  - Installing symfony/service-contracts (v2.2.0): Extracting archive
  - Installing symfony/polyfill-php73 (v1.20.0): Extracting archive
  - Installing symfony/console (v5.1.8): Extracting archive
  - Installing psr/log (1.1.3): Extracting archive
  - Installing monolog/monolog (2.1.1): Extracting archive
  - Installing voku/portable-ascii (1.5.6): Extracting archive
  - Installing phpoption/phpoption (1.7.5): Extracting archive
  - Installing graham-campbell/result-type (v1.0.1): Extracting archive
  - Installing vlucas/phpdotenv (v5.2.0): Extracting archive
  - Installing symfony/css-selector (v5.1.8): Extracting archive
  - Installing tijsverkoyen/css-to-inline-styles (2.2.3): Extracting archive
  - Installing symfony/deprecation-contracts (v2.2.0): Extracting archive
  - Installing symfony/routing (v5.1.8): Extracting archive
  - Installing symfony/process (v5.1.8): Extracting archive
  - Installing symfony/polyfill-php72 (v1.20.0): Extracting archive
  - Installing symfony/polyfill-intl-idn (v1.20.0): Extracting archive
  - Installing symfony/mime (v5.1.8): Extracting archive
  - Installing symfony/http-foundation (v5.1.8): Extracting archive
  - Installing symfony/http-client-contracts (v2.3.1): Extracting archive
  - Installing psr/event-dispatcher (1.0.0): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v2.2.0): Extracting archive
  - Installing symfony/event-dispatcher (v5.1.8): Extracting archive
  - Installing symfony/error-handler (v5.1.8): Extracting archive
  - Installing symfony/http-kernel (v5.1.8): Extracting archive
  - Installing symfony/finder (v5.1.8): Extracting archive
  - Installing symfony/polyfill-iconv (v1.20.0): Extracting archive
  - Installing egulias/email-validator (2.1.24): Extracting archive
  - Installing swiftmailer/swiftmailer (v6.2.3): Extracting archive
  - Installing ramsey/collection (1.1.1): Extracting archive
  - Installing brick/math (0.9.1): Extracting archive
  - Installing ramsey/uuid (4.1.1): Extracting archive
  - Installing psr/simple-cache (1.0.1): Extracting archive
  - Installing opis/closure (3.6.1): Extracting archive
  - Installing symfony/translation-contracts (v2.3.0): Extracting archive
  - Installing symfony/translation (v5.1.8): Extracting archive
  - Installing nesbot/carbon (2.41.5): Extracting archive
  - Installing league/mime-type-detection (1.5.1): Extracting archive
  - Installing league/flysystem (1.1.3): Extracting archive
  - Installing league/commonmark (1.5.7): Extracting archive
  - Installing laravel/framework (v8.15.0): Extracting archive
  - Installing filp/whoops (2.9.1): Extracting archive
  - Installing facade/ignition-contracts (1.0.2): Extracting archive
  - Installing facade/flare-client-php (1.3.7): Extracting archive
  - Installing facade/ignition (2.5.2): Extracting archive
  - Installing fakerphp/faker (v1.12.0): Extracting archive
  - Installing fideloper/proxy (4.4.1): Extracting archive
  - Installing asm89/stack-cors (v2.0.2): Extracting archive
  - Installing fruitcake/laravel-cors (v2.0.3): Extracting archive
  - Installing psr/http-message (1.0.1): Extracting archive
  - Installing psr/http-client (1.0.1): Extracting archive
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
  - Installing guzzlehttp/psr7 (1.7.0): Extracting archive
  - Installing guzzlehttp/promises (1.4.0): Extracting archive
  - Installing guzzlehttp/guzzle (7.2.0): Extracting archive
  - Installing nikic/php-parser (v4.10.2): Extracting archive
  - Installing dnoegel/php-xdg-base-dir (v0.1.1): Extracting archive
  - Installing psy/psysh (v0.10.4): Extracting archive
  - Installing laravel/tinker (v2.5.0): Extracting archive
  - Installing hamcrest/hamcrest-php (v2.0.1): Extracting archive
  - Installing mockery/mockery (1.4.2): Extracting archive
  - Installing nunomaduro/collision (v5.1.0): Extracting archive
  - Installing webmozart/assert (1.9.1): Extracting archive
  - Installing phpdocumentor/reflection-common (2.2.0): Extracting archive
  - Installing phpdocumentor/type-resolver (1.4.0): Extracting archive
  - Installing phpdocumentor/reflection-docblock (5.2.2): Extracting archive
  - Installing sebastian/version (3.0.2): Extracting archive
  - Installing sebastian/type (2.3.1): Extracting archive
  - Installing sebastian/resource-operations (3.0.3): Extracting archive
  - Installing sebastian/recursion-context (4.0.4): Extracting archive
  - Installing sebastian/object-reflector (2.0.4): Extracting archive
  - Installing sebastian/object-enumerator (4.0.4): Extracting archive
  - Installing sebastian/global-state (5.0.2): Extracting archive
  - Installing sebastian/exporter (4.0.3): Extracting archive
  - Installing sebastian/environment (5.1.3): Extracting archive
  - Installing sebastian/diff (4.0.4): Extracting archive
  - Installing sebastian/comparator (4.0.6): Extracting archive
  - Installing sebastian/code-unit (1.0.8): Extracting archive
  - Installing sebastian/cli-parser (1.0.1): Extracting archive
  - Installing phpunit/php-timer (5.0.3): Extracting archive
  - Installing phpunit/php-text-template (2.0.4): Extracting archive
  - Installing phpunit/php-invoker (3.1.1): Extracting archive
  - Installing phpunit/php-file-iterator (3.0.5): Extracting archive
  - Installing theseer/tokenizer (1.2.0): Extracting archive
  - Installing sebastian/lines-of-code (1.0.2): Extracting archive
  - Installing sebastian/complexity (2.0.2): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting archive
  - Installing phpunit/php-code-coverage (9.2.3): Extracting archive
  - Installing doctrine/instantiator (1.4.0): Extracting archive
  - Installing phpspec/prophecy (1.12.1): Extracting archive
  - Installing phar-io/version (3.0.2): Extracting archive
  - Installing phar-io/manifest (2.0.1): Extracting archive
  - Installing myclabs/deep-copy (1.10.2): Extracting archive
  - Installing phpunit/phpunit (9.4.3): Extracting archive
65 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
72 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan key:generate --ansi
Application key set successfully.
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Using version ^1.6 for laravel/jetstream
./composer.json has been updated
Running composer update laravel/jetstream
Loading composer repositories with package information
Updating dependencies
Lock file operations: 9 installs, 0 updates, 0 removals
  - Locking bacon/bacon-qr-code (2.0.3)
  - Locking dasprid/enum (1.0.3)
  - Locking jaybizzle/crawler-detect (v1.2.103)
  - Locking jenssegers/agent (v2.6.4)
  - Locking laravel/fortify (v1.7.1)
  - Locking laravel/jetstream (v1.6.1)
  - Locking mobiledetect/mobiledetectlib (2.8.34)
  - Locking paragonie/constant_time_encoding (v2.3.0)
  - Locking pragmarx/google2fa (8.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 9 installs, 0 updates, 0 removals
  - Installing dasprid/enum (1.0.3): Extracting archive
  - Installing bacon/bacon-qr-code (2.0.3): Extracting archive
  - Installing jaybizzle/crawler-detect (v1.2.103): Extracting archive
  - Installing paragonie/constant_time_encoding (v2.3.0): Extracting archive
  - Installing pragmarx/google2fa (8.0.0): Extracting archive
  - Installing laravel/fortify (v1.7.1): Extracting archive
  - Installing mobiledetect/mobiledetectlib (2.8.34): Extracting archive
  - Installing jenssegers/agent (v2.6.4): Extracting archive
  - Installing laravel/jetstream (v1.6.1): Extracting archive
1 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: jenssegers/agent
Discovered Package: laravel/fortify
Discovered Package: laravel/jetstream
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
73 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Migration created successfully!
Do not run Composer as root/super user! See https://getcomposer.org/root for details
./composer.json has been updated
Running composer update inertiajs/inertia-laravel laravel/sanctum tightenco/ziggy
Loading composer repositories with package information
Updating dependencies
Lock file operations: 3 installs, 0 updates, 0 removals
  - Locking inertiajs/inertia-laravel (v0.2.15)
  - Locking laravel/sanctum (v2.8.1)
  - Locking tightenco/ziggy (0.9.4)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
    0 [>---------------------------]    0 [>---------------------------]  - Installing inertiajs/inertia-laravel (v0.2.15): Extracting archive
  - Installing laravel/sanctum (v2.8.1): Extracting archive
  - Installing tightenco/ziggy (0.9.4): Extracting archive
 0/3 [>---------------------------]   0%
 3/3 [============================] 100%Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: inertiajs/inertia-laravel
Discovered Package: jenssegers/agent
Discovered Package: laravel/fortify
Discovered Package: laravel/jetstream
Discovered Package: laravel/sanctum
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: tightenco/ziggy
Package manifest generated successfully.
74 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Copied Directory [/vendor/laravel/sanctum/database/migrations] To [/database/migrations]
Copied File [/vendor/laravel/sanctum/config/sanctum.php] To [/config/sanctum.php]
Publishing complete.

Inertia scaffolding installed successfully.
Please execute the "npm install && npm run dev" command to build your assets.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.

added 1156 packages, and audited 1156 packages in 22s

50 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> dev
> npm run development

> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js

98% after emitting SizeLimitsPlugin

 DONE  Compiled successfully in 26067ms                                                                                                                                                                                           2:44:01 AM

       Asset      Size   Chunks             Chunk Names
/css/app.css  4.38 MiB  /js/app  [emitted]  /js/app
  /js/app.js  2.01 MiB  /js/app  [emitted]  /js/app
The [/var/www/html/events/public/storage] link has been connected to [/var/www/html/events/storage/app/public].
The links have been created.

Application ready! Build something amazing.

Replace the following lines with your database name, username, and password and save the file.

cd blog

Step 2: Migrate Database Laravel

Let's setup the new database tables.

Open your .env file.

vim /.env

Replace the following lines with your database name, username and password and save the file.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=<database name>
DB_USERNAME=<database user>
DB_PASSWORD=<database password>

Now you can migrate your new database.

php artisan migrate

Step 3: Set storage permissions

Laravel Jetstream has now been installed, but when you visit the project from your browser you will see a permission error. Make sure to set your permission for your storage folder with the command below.

chmod 775 -R storage
chmod 775 -R storage/*

Laravel Jetstream is now installed and you are ready to go. Visit your project by visiting the following link.

http://<ipadress>/blog/public

Build something amazing.

Building laravel jetstream project 2021-08-30 11:05:41

There are no comments.

4737

Have questions about our services?

Contact our Sales team to get answers.

Contact Us
gomibako@aska-ltd.jp