Welcome Guest, Not a member yet? Register   Sign In
Overwrite config file composer
#4

(This post was last modified: 03-07-2020, 06:09 AM by captain-sensible.)

thinking about it my approach would work if you were using additional packages, that you wanted to keep updated via your repo but you want to overwrite a core Class in Config Directory say Routes.php then actually i think one of the maintainers needs to answer this one.

If you want to write your own class then thats not difficult and i'm doing that . If its one of your classes then its only a case of giving it a namespace then making sure it can be found . If your class is within a Directory , that itself is inside  app directory then for example i have a class called CheckSpam in a Directory called Andy : 
<?php namespace App\Andy;
 

class CheckSpam
{


from a controller i can make use of my class via stating this in controller:

use \App\Andy\CheckSpam;


then from a method i instantiate class and use a method:


$spamHandle = new CheckSpam();
    //CheckSpam is in app/Andy and has namespace App\Andy
        $logic = $spamHandle->filterSpam($cleanMessage);


f i do a composer update i'm pretty sure only items listed in composer.json will be updated/changed and my class's should be untouched ?
Reply


Messages In This Thread
Overwrite config file composer - by MatheusCastro - 03-06-2020, 06:46 AM
RE: Overwrite config file composer - by captain-sensible - 03-07-2020, 05:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB