#how to understand symfony project structure?

4 messages · Page 1 of 1 (latest)

feral breach
#

hey guys. i was wondering if smb could help me out? im learning php symfony and i saw this project: https://github.com/Sylius/Sylius
im trying to understand the project structure and all these files. so i have these questions:

  1. in here https://symfony.com/doc/3.x/quick_tour/the_architecture.html i found that bin dir is for Executable files (e.g. bin/console).. but what does it even mean? i cant double click files in this dir and run them, obviously. so is there a normal explanation what is bin dir used for? as always, the official documentation is very brief and worthless, so u have to bash ur head against the wall or just guess.
  2. what does the adr dir mean? address? or what?
  3. what is dir features for?
  4. in public dir there is .htaccess fiele. as i understand its somehow used for apache. do i need this file if i want to use nginx?
  5. what is Kernel.php for? in google it says: The Kernel is the core of Symfony. It is responsible for setting up all the bundles used by your application. but then theres a question what bundles? what does bundle even mean? bundle of what?
  6. where can i find a proper explanation about these files and directories? because they dont make any sense at all. im coming from java, so for me src dir is pretty clear, there u have dir Controller for controllers, Repository for repositories, etc. but why everything other than src directory is one big mess?

Thanks for any help, because its very difficult to understand how this mess is supposed to work.

GitHub

Open Source eCommerce Framework on Symfony. Contribute to Sylius/Sylius development by creating an account on GitHub.

You are my hero! Who would have thought that you would still be here after the first three parts? Your efforts will be well rewarded soon. The first three parts didn't look too deeply at the architect…

covert laurel
#

Sylius has a few things not part of Symfony in it:

  • ADR is Architecture Decision Record.
  • features are Gherkin files that define test cases

Symfony file structure isn't anything crazy, though much of what we get in Java land is the same but wrapped up in a neat little bow by our IDEs and build tools:

  • assets - static website scripts, images, CSS, etc. In a Java web app you may find these under src/main/resources/static
  • bin - binary files executed using php cli
  • config - config files for the project. Similar to src/main/resources
  • data - database files if using sqlite
  • migrations - database migrations. Version control for your DB schema
  • public - build directory for the most part. Some assets may be stored here like favicons, PWA manifests, .htaccess, nginx.conf (maybe), etc.
  • src - you already get this. It's the app source code
  • templates - yet another thing normally in src/main/resources. They're just HTML page templates like Laravel blade, thymeleaf, etc.
  • tests - src/test/java
  • translations - localisation
  • var - internal storages. Normally just logging is stored here
  • vendor - third-party dependencies and bundles are here.
#

Bundles are reusable code and integrations with Symfony. Something like libraries that integrate and provide beans for micronaut and spring in Java.

humble falcon
#

In my experience binaries are .exe or other applications that the PHP service can lean on to do things. Like if you want to get a directory listing you can use a system application like ls.. ```php
<?php

$output = [];
$return_var = 0;

exec('ls -a', $output, $return_var);

if ($return_var === 0) {
foreach ($output as $line) {
echo htmlspecialchars($line) . "<br>";
}
} else {
echo "Error executing ls command.";
}

?>
```... and don't need anything special in the /bin/ directory?