0
How to configure my directories in composewr.json,
My directories are like this and not right
Vizuare
-vendor
-composer
-php-class
-src
-DB
-Model
-Page.php
-phpmailer
-rain
-slim
-autoload.php
-views
-views-cache
composer.json
composer.lock
index.php
Why my folder structure is not working?
Your codes are in
php-class
? There is the filecomposer.json
in this directory? What is its content? What are the namespaces in PHP files?– Woss
PHP yes HTML inside views
– Julio Silva
{ "name": "Julio/vizuare", "Authors": [ { "name": "Júlio Silva", "email": "" } ], require": { "phpmailer/phpmailer":"5.2.22", "slim/slim":"2.0", "Rain/raintpl":"3.0.0" }, "autoload": { "psr-4": { "Launch ": "vendor php-class src" } } }
– Julio Silva
this and my Commander
– Julio Silva
But this file is in the root directory or inside
php-class
? There must be two files, one in each directory.– Woss
It depends a lot on the namespaces you will use in the files, I would personally recommend that you use the namespaces as a "directory" scheme, so the organization is intuitive and you only need to define the "main namespace". Just to feature, the sell folder should usually count the libs and 3rdparty packages, things like settings, models and the like "from the application" should be elsewhere.
– Guilherme Nascimento
My root folder and Vizuare and inside this directory are my vendor folders, views, views-cache. within vendor this my folder Composer, class-php, phpmailer, Rain and slim. Inside class-php are all my php codes, and inside views are my html pages
– Julio Silva
I think you’re mixing
vendor
with the application, this is not the purpose of the folder "vendor", I think you did not understand well what is thecomposer
still, I personally recommend not using or structuring something that if you still don’t understand well how it works friend. You can take a look at popular frameworks to see how they organize the Models, Views and Controllers, an example is Laravel: https://laravel.com/docs/5.4/structure (of course not to follow the lines, it’s just to understand and create your own)– Guilherme Nascimento
I appreciate the tip, very valuable
– Julio Silva