Welcome Guest, Not a member yet? Register   Sign In
Composer package or module?
#1

When to create a composer package and when is it indicated to create a module?
Reply
#2

This question came up when I saw the myth/auth package. As it contains views I also wondered how I could change them and include those changes in my repository without messing up the original content. So I wondered if this type of package (and others) would be better delivered as a module, and when each case is recommended.
  Reading more, I found the answer: https://github.com/lonnieezell/myth-auth...g.md#views
Sorry for the early question.
Reply
#3

Hi!

My solution is simple, but i don't know if it's the best solution to this. To modify or change the views you could write a config and overwrite these settings, see example below!

PHP Code:
<?php 

namespace Config;

use 
Myth\Auth\Config\Auth;

class 
Auth extends Auth
{
 
/**
 * --------------------------------------------------------------------
 * Views used by Auth Controllers
 * --------------------------------------------------------------------
 *
 * @var array
 */
 
public $views = [
 
'login'   => 'Myth\Auth\Views\login',
 
'register' => 'Myth\Auth\Views\register',
 
'forgot' => 'Myth\Auth\Views\forgot',
 
'reset'   => 'Myth\Auth\Views\reset',
 
'emailForgot' => 'Myth\Auth\Views\emails\forgot',
 
'emailActivation' => 'Myth\Auth\Views\emails\activation',
 ];

Reply
#4

Besides the specifics of Myth:Auth, my rule of thumb about a project-specific module versus a Composer package is simply “will I use this is in other projects?” Once you have a package template and toolkit, it takes very little time to turn a module into a package so I will do this even if I only plan on using it in two projects.
Reply
#5

Thank you all. @MGatner got the idea.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB