hello I am trying to organize my classes in the composer-phpunit format, my classes already work interlacing them with require but I would like to have my code by folders and not all the files in the src folder my structure is the following
project structure
I thought that adding two namespaces in the psr-4 attribute of the composer file would work this is the structure of my composer file
{
"name": "ramirogg/p4wsnc",
"repositories": [
{
"type":"vcs",
"url":"https://github.com/r4m1r0gg/PIEZAS_4_WEBSITES_NEW_CONCEPT"
}
],
"description": "p4wsnc library",
"type": "library",
"license": "MIT",
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"p4wsncbase\": "src/clases_base/",
"p4wsnctobase\": "src/clases_directas_ala_base/"
},
"files": [
"src/helpers.php"
]
},
"require-dev": {
"phpunit/phpunit": "^9.5@dev"
}
}
This is the head class and this is how I defined the namespace
<?php
namespace p4wsncbase;
class Head {
//here is all my code if you need to see it let me know
}
this is the sethead class and this is how i call the head class
<?php
namespace p4wsnctobase;
use p4wsncbaseHead;
class SetHead {}
in the same way I do it for the other classes I have an even class for each class within the classes_base folder, for example for the head class I have the sethead class for the body class I have the setbody class and for the tag class I have the settag class the classes that start with set are in the folder classes_directas_ala_base
finally this is how I call the classes sethead, setbody and settag in the index
<?php
require __DIR__ . '/vendor/autoload.php';
use p4wsnctobaseSetHead;
use p4wsnctobaseSetBody;
use p4wsnctobaseSetTag;
I would like to thank you forever, I really would like to maintain this structure, thank you very much in advance
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…