Giter VIP home page Giter VIP logo

artisan-view's Introduction

artisan-view

Artisan View

Latest Version on Packagist Total Downloads Software License Build Status Code Climate Code Quality StyleCI

This package adds a couple of view-related commands to Artisan in your Laravel projects. It is super simple to use and easy to understand for everyone.

Installation

Via composer:

$ composer require sven/artisan-view

Or add the package to your dependencies in composer.json and run composer update to download the package:

{
    "require": {
        "sven/artisan-view": "^1.0"
    }
}

Next, add the ArtisanViewServiceProvider to your providers array in config/app.php:

// config/app.php
'providers' => [
    ...
    Sven\ArtisanView\ArtisanViewServiceProvider::class,
];

If you want to only load this service provider in a specific environment (like local or development), take a look at sven/env-providers.

Usage

If you now run php artisan you can see two new commands:

  • make:view
  • scrap:view

Create a view

# Create a view 'index.blade.php' in the default directory
$ php artisan make:view index

# Create a view 'index.blade.php' in a subdirectory ('pages')
$ php artisan make:view pages.index

# Create a view in a custom directory
$ php artisan make:view index --directory=custom/path

# Give the view a custom file extension
$ php artisan make:view index --extension=html

# Extend an existing view
$ php artisan make:view index --extends=app

# Add a section to the view
$ php artisan make:view index --section=content

# Add an inline section to the view
$ php artisan make:view index --section="title:Hello world"
# Remember to add quotes around the section if you want to use spaces

# Add 2 sections to the view
$ php artisan make:view index --sections=title,content

# Add one inline and one block-level section to the view
$ php artisan make:view index --sections="title:Hello world,content"
# Remember to add quotes around the sections if you want to use spaces

# Create a resource called 'products'
$ php artisan make:view products --resource

# Create a resource with only specific verbs
$ php artisan make:view products --resource --verbs=index,create,edit

# Create a resource that extends views and adds sections
$ php artisan make:view products --resource --extends=layout --sections=foo,bar

# Use the force flag to force the creation of the view
$ php artisan make:view index --force
# This will overwrite a view if it already exists

Scrap a view

# Scrap the view 'index.blade.php'
$ php artisan scrap:view index

# Remove the view by dot notation
$ php artisan scrap:view pages.index

Contributing

All contributions (pull requests, issues and feature requests) are welcome. Make sure to read through the CONTRIBUTING.md first, though. See the contributors page for all contributors.

License

sven/artisan-view is licensed under the MIT License (MIT). Please see the license file for more information.

artisan-view's People

Contributors

casperlaitw avatar sasin91 avatar svenluijten avatar vinkla avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.