0

I'm struggling around with Silex and its Project Structure. I'm using PHP for around 10 years now, but I always used tools like Np++. Now I get started with PhpStorm and I feel like a total newbie.

What I'm trying, is to create a Silex Project. After starting a new Composer Project I get the following Structure:

--doc
--src
----Silex
------[Some Silex files]
--tests
--vendor
[some rootfiles]

Let's come to my problem: In my understanding, I would put my files in a folder foobar under the src folder.

The part which is not clear to me is:

  • Where to put my index.php
  • Which folders need to be uploaded
  • How to include the right files in the right place

In the past I had a project structure like:

-- config
-- includes
-- models
-- modules
-- templates
-- resources
-- js
-- [etc]
index.php
includes.php
[other files]

I've been googling around for some hours and I didn't find any good explanation. Can someone give me an advice or an good tutorial? Even if it cost some bucks. It is for a new job and I would be very sad if it would fail because of such little problem. Thank you!

Answers in English or German are welcome.

Netzmensch
  • 111
  • 1
  • 7
  • Go through this: https://www.youtube.com/watch?v=c7av3YkI5e4&list=PLZU0qJlzY07WwVlxzHMwN0pJmMrc7LMLT – Nitish Kumar Jul 18 '17 at 10:09
  • been there, done that. didn't helped me ;( – Netzmensch Jul 18 '17 at 10:33
  • 2
    This has nothing to do with PhpStorm -- it's all about Silex itself. When you create new Composer project with PhpStorm ... it basically executes this kind of command: `composer create-project fabpot/silex-skeleton path/to/install` and then opens that newly created folder as a project (that's how it works in general). If unsure -- create new Silex project in command line first and then use "Open" in PhpStorm and point to the project root folder. – LazyOne Jul 18 '17 at 11:09
  • 2
    Some links: 1) Silex docs: https://silex.symfony.com/doc/2.0/usage.html 2) different PhpStorm manuals and tutorials: https://confluence.jetbrains.com/display/PhpStorm/Tutorials – LazyOne Jul 18 '17 at 11:10

2 Answers2

0

My problem was, that I ignored the fact: Silex based on Symphony. For beginners it is mandatory, to start with Symphony !

Netzmensch
  • 111
  • 1
  • 7
  • Definitely a good point here. Why? Isn't Symfony (Framework) overkill? Probably, but you don't start cycling on a ten-speed racing bike. – mike Aug 17 '17 at 23:06
0

Consider Fabien's skeleton project from https://github.com/silexphp/Silex-Skeleton.

It illustrates the essential directory structure you'll use.

That said, unless you require the micro framework, hop into Symphony 3.3 to get running on the exciting things coming ahead in Symfony 4.

See Fabien's blog at https://medium.com/@fabpot for updates.

mike
  • 1,786
  • 2
  • 19
  • 31