daikazu/laravel-go

This package is abandoned and no longer maintained. No replacement package was suggested.

Get up and go with this highly opinionated package for developing websites.

v4.1.2 2023-01-23 15:59 UTC

README

Envault banner

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Laravel Go =>

Introduction

If you are like me and find yourself repeating the same steps everytime when starting to build a new site with Laravel, then look no further. Get up and GO with this light yet highly opinionated package for developing websites using the TALL stack. It helps you set up some view folder organization and a few sensible packages to get you started. Not to mention a sweet page build artisan command.

The idea behind this package is to install, use, and then remove.

So what are you waiting for, get GOing!

Feel free to give input and suggestions to our discussion board.

Installation

You can install the package via composer:

composer require daikazu/laravel-go --dev

Usage

One Time Install

Create a go-packages.json file in you project root folder or use the following artisan command to create it for you.

php artisan go:init

THe created file will look as follows:

{
    "composer_packages": {
        "require": {},
        "require-dev": {}
    },
    "npm_packages": {
        "dependencies": {},
        "devDependencies": {}
    }
}

Add any additional packages you would like to install in your setup or copy and paste the following starter packages.

Additionally, you can add the -d or the --default flags when running the go:init command to add the following automatically.

{
    "composer_packages": {
        "require": {
            "artesaos/seotools": "^v1.0.0",
            "daikazu/laravel-glider": "^2.0.1",
            "illuminatech/url-trailing-slash": "*",
            "livewire/livewire": "^2.11",
            "spatie/laravel-google-fonts": "^1.2",
            "spatie/laravel-backup": "^8.1",
            "spatie/laravel-sitemap": "^6.2",
            "spatie/schema-org": "^3.13"
        },
        "require-dev": {
            "barryvdh/laravel-debugbar": "^3.7",
            "barryvdh/laravel-ide-helper": "^2.9",
            "beyondcode/laravel-query-detector": "^1.6",
            "fakerphp/faker": "^1.9.1",
            "laravel/pint": "^1.0",
            "laravel/sail": "^1.0.1",
            "mockery/mockery": "^1.4.4",
            "nunomaduro/collision": "^6.4",
            "nunomaduro/larastan": "^2.4.0",
            "pestphp/pest": "^v1.22.3",
            "pestphp/pest-plugin-laravel": "^v1.4.0",
            "phpstan/extension-installer": "^1.2.0",
            "phpstan/phpstan-deprecation-rules": "^1.1.1",
            "phpstan/phpstan-phpunit": "^1.3.3",
            "phpunit/phpunit": "^9.5",
            "spatie/laravel-ignition": "^1.6.4",
            "spatie/laravel-ray": "^1.32.0"
        }
    },
    "npm_packages": {
        "dependencies": {},
         "devDependencies": {
            "@alpinejs/collapse": "^3.11.1",
            "@alpinejs/focus": "^3.11.1",
            "@alpinejs/intersect": "^3.11.1",
            "@alpinejs/persist": "^3.11.1",
            "@defstudio/vite-livewire-plugin": "^1.0.4",
            "@prettier/plugin-php": "^0.19.3",
            "@shufo/prettier-plugin-blade": "^1.8.6",
            "@tailwindcss/aspect-ratio": "^0.4.2",
            "@tailwindcss/forms": "^0.5.3",
            "@tailwindcss/typography": "^0.5.7",
            "alpinejs": "^3.11.1",
            "autoprefixer": "^10.4.13",
            "axios": "^1.2.3",
            "cross-env": "^7.0.3",
            "focus-visible": "^5.2.0",
            "glob-all": "^3.3.1",
            "laravel-vite-plugin": "^0.7.3",
            "lodash": "^4.17.21",
            "postcss": "^8.4.21",
            "postcss-focus-visible": "^7.1.0",
            "postcss-import": "^15.0.0",
            "postcss-nested": "^6.0.0",
            "prettier": "^2.8.3",
            "prettier-plugin-tailwindcss": "^0.2.1",
            "tailwindcss": "^3.2.4",
            "tailwindcss-debug-screens": "^2.2.1",
            "vite": "^4.0.4"
        }
    }
}

install the initial scaffolding by running the following artisan command.

php artisan go:install

Additionally, you can add the -d or the --default flags the go:install command, and it will auto initialize with the default packages

NOTE this command should only be run once. A repeated run will overwrite any modified files.

this will prompt you for a site name and scaffold out the following files.

.
├── app
│   ├── Console
│   │   ├── Commands
│   │   │   └── GenerateSitemap.php
│   │   └── Kernel.php
│   └── View
│       └── Components
│           └── MetaData.php
├── config
│   ├── backup.php
│   ├── feed.php
│   ├── filesystems.php
│   ├── seotools.php
│   ├── sitemap.php
│   └── website.php
├── resources
│   ├── css
│   │   └── app.css
│   ├── js
│   │   ├── app.js
│   │   └── bootstrap.js
│   └── views
│       └── web
│           ├── layout
│           │   ├── footer.blade.php
│           │   ├── head
│           │   │   ├── favicon.blade.php
│           │   │   ├── fonts.blade.php
│           │   │   ├── meta-data.blade.php
│           │   │   ├── scripts.blade.php
│           │   │   ├── styles.blade.php
│           │   │   └── tracking.blade.php
│           │   ├── head.blade.php
│           │   └── header.blade.php
│           ├── layout.blade.php
│           └── sections
│               └── static
│                   └── home.blade.php
├── routes
│   └── web.php
├── .gitignore
├── .prettierrc
├── postcss.config.js
├── tailwind.config.js
└── vite.config.js

Install composer dependencies

composer update

Install node dependencies and build your assets

npm install && npm run dev

We recommend using pnpm instead of the default npm.

Don't forget to change configs and add environment variable as needed.

Static Page Creation Tool

Quickly create a static page using the following command. Creates blade.php file and adds entry into your routes files.

php artisan go:make-static my-page mycustomname

This will create a my-page.blade.php in the resources/views/web/sections/static/ folder

An entry is added to your web.php routes file.

Route::view('my-page', 'web.sections.static.my-page')->name('my-page');

Options

Option Required Description
path true URL
name false View name
--title= false Meta Title
--description false Meta Description

by appending a / or /index at the end of your path you tell the command to make and index.blade.php file in the appropriate folder.

Example:

php artisan go:make-static post/comments/
/resources/views/web/sections/static/post/comments.index.blade.php

Created file: /resources/views/web/sections/static/post/comments.index.blade.php

Route::view('post/comments/', 'web.sections.static.post.comments.index')->name('post.comments.index');

Website Duplication Tool

Crawl and Duplicate an existing website to the Laravel-Go way of things. Currently, a work in progress but is mostly feature complete. this will crawl and scrape the website creating routes, views, and assets. use the optional --fileter= flag to filter out any unwanted URIs.

php artisan go:duplicate https://example.test --filter=/blog,/image

This will copy the main header and footer from the website and create a header.blade.php and footer.blade.php file in the resources/views/web/layout/ folder and remove the <header> and <footer> from any page that has them. All other page content will be copied into its own blade.php file in the resources/views/web/sections/static/ folder and placed between the main section directives.

Default Packages

Composer

Installed

Recommended

NPM

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.