laravel - Potion is a pure PHP asset manager for Laravel 5 based off of Assetic.

Overview

laravel-potion

Potion is a pure PHP asset manager for Laravel based off of Assetic.

Description

Laravel 5 comes with a great asset manager called Elixir. While there is nothing wrong with Elixir, it requires you to install Node.js, Gulp, and dependent NPM packages on all of your web serves. While there is nothing wrong with this if you have other needs for those technologies, it seemed unnecessary to us to install that stack solely for the sake of handling assets. So we wrote Potion. Potion is a pure PHP solution, based off of Assetic that allows you to handle your assets in the same technology stack that your application is written in.

When using Potion the you will often see is "resources" and "assets". Think of resources as the raw resources inside of Laravel resources direction. Think of assets as what Potion will generate and will ultimately be served to visitors.

Laravel Support

At this time Potion only supports Laravel 5.1 or higher. While Laravel 4 support was easy to implement in code, the time needed to support requests was too much.

Features

  • Fully integrated into Laravels' artisan commands
  • Asset versioning support
  • Asset CDN Url support
  • Blade Helpers for Asset inclusion in templates
  • Command to clear all assets already published on disk
  • Makes use of Cache configuration, and not disk, in order to account for load balanced servers.
  • Supports the following filters from Assetic:
    • OptiPngFilter
    • CssImportFilter
    • CssRewriteFilter
    • CssMinFilter
    • CssCompressorFilter from YUI
    • LessphpFilter
    • JSMinFilter
    • JpegoptimFilter
    • JsCompressorFilter from YUI
    • ScssphpFilter

Installation

  1. Add 'classygeeks/potion' package to your composer.json file:

  2. Add the Potion Service provider to your config/app.php file under the predefined "providers" array:

'providers' => [
	'Illuminate\Foundation\Providers\ArtisanServiceProvider',
	...
	'ClassyGeeks\Potion\PotionServiceProvider'
	...
	],
  1. Publish the config file
	php artisan vendor:publish

You will now see to new Potion artisan commands. The configuration is very well documented and should be able to get even the most complex projects going quickly.

Future Features

  • Resource watching command functionality
  • Support for more filters from Assetic

Rules For Contributing

  • Please make sure all changed files are run through gofmt
  • Submit a PR for review
  • Your name will be added below to Contributors

Author

Matthew R. Miller

Contributors

Matthew R. Miller

License

MIT License

Comments
  • Unable to install

    Unable to install

    When I do composer update I get a dependency error: Problem 1 - Installation request for classygeeks/potion 1.0.@dev -> satisfiable by cl assygeeks/potion[1.0.x-dev]. - classygeeks/potion 1.0.x-dev requires kriswallsmith/assetic 1.3.@dev -> n o matching package found.

    Potential causes:

    • A typo in the package name
    • The package is not available in a stable-enough version according to your min imum-stability setting see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion f or more details.

    Read http://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

    opened by maxi032 10
  • Fix for L5.1 codebase

    Fix for L5.1 codebase

    Minor fix for passing the 'potion' only section of config to the commands instead of the entire config block Moderate fixed to the service provider to handle the deprecated call to createMatcher (which returns a regex version of the supplied pattern)

    opened by mattglover11 9
  • path not specified

    path not specified

    whenever i am making command php artisan potion:make-assets its saying the system canot find the path specified........ may be more docmentation is needed

    opened by Dunebook 8
  • Undefined index: resource_path (Laravel 4.2)

    Undefined index: resource_path (Laravel 4.2)

    Hi, I have this error when I try php artisan potion:make-assets The path is valid in my config file, so I wonder if the config file is properly loaded, or if it's even loaded, with Laravel 4.2.

    opened by rombat 6
  • SCSSPHP locked to v0.1.1, latest is 0.6.6

    SCSSPHP locked to v0.1.1, latest is 0.6.6

    Is there a reason why leafo/scssphp is locked to v0.1.1? I require some newer functionality available in the later versions.

    Requiring a newer version of leafo/scss in my composer.json will revert potion to an earlier version (v.1.0.0) instead of v1.0.3 (obviously because that version of potion only suggests scssphp instead of requiring it).

    I could do a PR, but I wanted to make sure that there wasn't some sort of underlying issue where we are required to use scssphp v0.1.1 instead of something more up-to-date.

    opened by almightynassar 2
  • Blade Helpers for listing ALL Styles or ALL Scripts with cacheBusting option

    Blade Helpers for listing ALL Styles or ALL Scripts with cacheBusting option

    Blade helper to output a list of compiled styles listStyles($withCacheBust = true)

    listScripts - create a list of compiled scripts for insertion into page (footer, best practice)

    opened by mattglover11 2
  • Undefined index: assets_path in L5

    Undefined index: assets_path in L5

    Running php artisan potion:make-assets in Laravel 5 throws "Undefined index: assets_path" exception. As far as I see there is a problem in the PotionServiceProvider getConfig() method. Replacing

    \Config::get("potion{$this->packageSeparator}config");
    

    with

    \Config::get("potion");
    

    seems to fix the issue

    opened by tudor2004 1
  • - Updated leafo/scssphp dependency

    - Updated leafo/scssphp dependency

    Matt,

    Love the package, but your leafo/scssphp dependency (0.1.) points to a really old version of leafo/scssphp that doesn't support @extend, causing the potion:make-assets command to break when it tries to process a SCSS file containing @extend. Updating the dependency to the more recent 0.6 fixes this issue.

    opened by dlowhorn 0
  • Output append

    Output append

    Matt,

    You've probably figured out by now that I'm using Potion on project and extending/modifying it to suit my needs. I know that not everyone will have the same needs I do, but I figured it would be better to submit each of my modifications as pull requests in case you decide some of them are worth integrating with your core project.

    This one is a new potion configuration option called output_append

    My Use Case

    Sometimes, especially during development, I want to process multiple SCSS files into individual CSS files that are then included on different pages of my project individually. So, given the following file structure, I might have 3 pages on a project and each would individually want to include its own specific CSS.

    /resources
        /assets
            /sass
                /pages
                    page1.scss
                    page2.scss
                    page3.scss
    

    The only way to do that with Potion right now is to setup three individual potions in the configuration, which grows tiresome as I add more pages to the project. Instead, I wanted to be able to have a single potion that would export sass/pages/*.scss to individual CSS files. Setting output = false gets me part of the way there, but the resulting files keep their exact file names, leading to .scss files, not .css files.

    My solution: output_append.

    This new, optional parameter may be set on any potion, and is simply concatenated to the end of the resulting asset. Thus the following potion is possible:

         //
        // Page-specific CSS
        [
            // Resources, relative paths to 'resource_path' above, can be any valid file or glob pattern
            'resources' => [
                '/sass/pages/*.scss',
            ],
            'filters' => [
                'css_import',
                'css_rewrite',
                'css_scssphp',
            ],
            'output'    => FALSE, // keep files separate
            'output_append' => '.css'
        ],
    

    That would cause every scss file in /sass/pages to be processed into an individual file that would then have .css appended to the resulting asset name, which I could then include individually on any page of my project as required.

    opened by dlowhorn 0
  • Helpers cleanup

    Helpers cleanup

    I ran into an issue where I incorrectly assumed the order of parameters between assetCss and the other asset helpers would be similar, but they weren't, so I moved the $rel argument to the end of the argument list so that $name and $version would be the first two arguments on all of the asset helpers. I recognize this would constitute a backwards-compatibility issue for those using Potion 1.x.

    I also needed the ability to set the defer attribute on certain JS assets, so I added that optional argument to the assetJs helper.

    The assetUrl method was not including a ? before the cache-busting v URL parameter, so I added that.

    Lastly, and I know this is a style preference, I think the generated asset HTML tags would almost always be wanted on their own line, so I added a newline character to the HTML returned from each asset helper.

    opened by dlowhorn 0
  • Installation issues on L5.1

    Installation issues on L5.1

    Incorrect dependencies for JSqueeze Incorrect namespacing of JSqueeze via the Assetic filter (\Patchwork\JSqueeze) Incorrect reference to JSqueeze Special Vars constant due to conflict in dependencies b/w Potion and Assetic

    opened by mattglover11 1
  • Support CommonJS

    Support CommonJS

    When using node, the excellent browserify package can be used to compile commonJS packages into one file. It would be great if potion would support this as well.

    The PHP package https://github.com/mattcg/cjsDelivery supports compiling commonJS packges and could be used for this.

    enhancement 
    opened by Zae 1
  • Watching For Changes

    Watching For Changes

    Is there a way you can make the artisan command watch for changes then make the assets? Like this http://symfony.com/doc/current/cookbook/assetic/asset_management.html#dumping-asset-files ?

    enhancement 
    opened by russweas 4
Owner
Matthew R. Miller
Passionate Engineer Leader​
Matthew R. Miller
Laravel Manager - provides some manager functionality for Laravel

Laravel Manager Laravel Manager was created by, and is maintained by Graham Campbell, and provides some manager functionality for Laravel. Feel free t

Graham Campbell 371 Dec 17, 2022
Laravel Manager provides some manager functionality for Laravel

Laravel Manager Laravel Manager was created by, and is maintained by Graham Campbell, and provides some manager functionality for Laravel. Feel free t

Graham Campbell 371 Jul 11, 2022
Theme and asset management for laravel

Laravel-Themevel Themevel is a Laravel theme and asset management package. You can easily integrate this package with any Laravel based project. Featu

Shipu Ahamed 339 Dec 23, 2022
Theme and asset management for laravel

Laravel-Themevel Themevel is a Laravel theme and asset management package. You can easily integrate this package with any Laravel based project. Featu

Shipu Ahamed 339 Dec 23, 2022
A Laravel package to speed up deployment by skipping asset compilation whenever possible.

Airdrop for Laravel Read the full docs at hammerstone.dev/airdrop/docs. Hammerstone Airdrop for Laravel is a package that speeds up your deploys by sk

Hammerstone 160 Nov 24, 2022
A simple pure PHP RADIUS client supporting Standard and Vendor-Specific Attributes in single file

BlockBox-Radius A simple pure PHP RADIUS client supporting Standard and Vendor-Specific Attributes in single file Author: Daren Yeh [email protected]

null 2 Oct 2, 2022
File manager module for the Lumen PHP framework.

Lumen File Manager File manager module for the Lumen PHP framework. Please note that this module is still under active development. NOTE: Branch 5.1 i

Digia 40 Aug 20, 2022
Laravel-tagmanager - An easier way to add Google Tag Manager to your Laravel application.

Laravel TagManager An easier way to add Google Tag Manager to your Laravel application. Including recommended GTM events support. Requirements Laravel

Label84 16 Nov 23, 2022
Migrator is a GUI migration manager for Laravel which you can create, manage and delete your migration.

Migrator Migrator is a GUI migration manager for Laravel which you can create, manage and delete your migration. Installation: To install Migrator you

Reza Amini 457 Jan 8, 2023
Seo Manager Package for Laravel ( with Localization )

Seo Manager Package for Laravel ( with Localization ) lionix/seo-manager package will provide you an interface from where you can manage all your page

Lionix 205 Dec 23, 2022
Bring multi themes support to your Laravel application with a full-featured Themes Manager

Introduction hexadog/laravel-themes-manager is a Laravel package which was created to let you developing multi-themes Laravel application. Installatio

hexadog 86 Dec 15, 2022
File manager for Laravel

Laravel File Manager DEMO: Laravel File Manager Vue.js Frontend: alexusmai/vue-laravel-file-manager Documentation Laravel File Manager Docs Installati

Aleksandr Manekin 937 Jan 1, 2023
Webhook Manager for Laravel Nova

Webhook Manager for Laravel Nova A Laravel Nova tool that allows users to create and manage webhooks based on Eloquent Model events. A tool for Larave

Doug Niccum 9 Dec 27, 2022
Registry Manager for Laravel

Registry manager for Laravel 4 & 5. An alternative for managing application configurations and settings. Now with the magic of caching.

Daniel Stainback 22 Sep 28, 2020
Service manager for Slim compatible with Laravel packages

SlimServices SlimServices is a service manager for the Slim PHP microframework based on Laravel 4 service providers and DI container, allowing you to

its 76 Jul 23, 2022
A Laravel package to retrieve key management from AWS Secrets Manager

A Laravel package to retrieve key management from AWS Secrets Manager Communication via AWS Secrets Manager may incur unnecessary charges. So we devel

null 2 Oct 10, 2022
Menu ordering/management application demo, like Wordpress menu manager

Menu manager like Wordpress using Laravel and Nestable See demo at: http://laravel-menu-builder.gopagoda.com/admin/menu Tutorial coming up at: http://

Maksim Surguy 336 Nov 25, 2022
🧩 Generator Manager for 🙃 Phony Framework

?? Generator Manager This repository contains the Generator Manager for ?? Phony Framework. ?? Start generating fake data with ?? Phony Framework, vis

Phonyland 2 Jan 7, 2022
A PocketMine plugin to create custom ranks and permissions manager!

Ranks A PocketMine plugin to create custom ranks and permissions manager! ##Commands Command Usage Example /rank add - adds ranks! /rank add <rank_nam

DevilDev 4 Apr 6, 2022