Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Git Version Strategy Bundle Laravel Package

emileperron/git-version-strategy-bundle

View on GitHub
Deep Wiki
Context7

Symfony asset versioning based on Git

This is a small Symfony bundle that implements a custom version strategy which uses the current Git commit short-hash as the version identifier.

This will turn the URL of your assets from this:

/css/style.css

to

/css/styles.css?v=b4703f8

This will ensure that you assets always match the current version of your project by eliminating browser caching issues.


Getting started

To get started, add the bundle to your project using Composer, like so:

composer require emileperron/git-version-strategy-bundle

Then, in your config/bundles.php file, include the bundle like so:

<?php

return [
    // ...
    Emileperron\GitVersionStrategyBundle\EmileperronGitVersionStrategyBundle::class => ['all' => true],
];

Once that's done, you should be all set! The bundle automatically updates the configuration for framework.assets.version_strategy to use the GitVersionStrategy.


Manual configuration of the VersionStrategy

If for some reason the configuration is not set automatically, which can happen if another bundle also changes this configuration, define the following configuration in your config/packages/framework.yaml:


framework:
    assets:
        version_strategy: 'Emileperron\GitVersionStrategyBundle\Asset\GitVersionStrategy'

Safe mode, execution operator and shell_exec()

This bundle uses the Execution Operator in order to get the current commit's hash. It is important to note that this will not work when safe mode is enabled or shell_exec() is disabled.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings