Download the PHP package berthott/nglaravel without Composer
On this page you can find all versions of the php package berthott/nglaravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download berthott/nglaravel
More information about berthott/nglaravel
Files in berthott/nglaravel
Package nglaravel
Short Description Build your angular frontend as part of your laravel project.
License MIT
Informations about the package nglaravel
NgLaravel
A helper for Angular + Laravel projects.
Easily use Laravel as your API backend and Angular with its CLI as frontend. Inspired by fristys' Blogpost.
Installation
You should set up your Laravel project first. Then require the package.
Set up Angular
Choose a folder within or outside of your Laravel project to install your Angular project to. I recommend using the Angular CLI inside resources/angular
.
In angular.json
do the following changes:
In the package.json
of the angular project do the following changes:
By default default the package will look for Angulars output in public/assets/angular
. If you choose to change the output path in angular.json
please set the output
property in config/angular.php
or the NG_OUTPUT_PATH
in .env
accordingly.
How it works
The package will set up a generic web route that will catch anything apart from routes specified in the except_routes
config, and forward it to a view including Angulars output scripts. In development these are the static files, in production a controller will read stats.json
to include the correctly hashed files.
Options
To change the default options use
output
: Determines Angulars path inside the public folder. Defaults toenv('NG_OUTPUT_PATH', 'assets/angular')
.except_routes
: Determines the beginning of routes that should not be forwarded to angular. Defaults to['api']
.middleware
: Configurations for the route. Defaults to['web']
.
To change the default view use
Compatibility
Tested with Laravel 10.x and Angular 16.
License
See License File. Copyright © 2023 Jan Bladt.