Core modules override without being overwritten with a composer-update (v1)

  • Hi, just a quick question:

    I'd like to make some minor adjustments to the User module (giving always at least the permission to view the dashboard, even if the administrator forgets to give the rights to do so).

    Is there any way to extend/override the default behavior of a module? It'd be a bit overkill to duplicate the module and make my own CustomUsers just for one line of code I have to change...

    Same happens with Media module. I have minor changes to distinguish between audio & video files, but I lose all my changes at each composer-update.

    I need to have the whole module in .gitignore in order to 'rescue' my modifications, as a workaround.

    So, where'd be the best place to apply this changes without breaking the flow / modularity ?

  • admin


    Yes you have 2 options:

    • Commit the module, and remove it from the composer.json file
    • Fork the module, and use your fork instead of the original one.

  • @nWidart
    Fantastic, many thanks, I'll try the first option

  • @nwidart Hi, i try to remove from composer, and composer delete my modules on server deploy, why?

    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
    Package operations: 26 installs, 44 updates, 2 removals
    Deleting Modules/Workshop/ - deleted
    Deleting Modules/User/ - deleted

  • admin

    This is normal composer behaviour. After composer has removed your module you can get it back using git, or just by copying the folder before hand and put it back afterwards.

Log in to reply

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.