Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creating your first Slim Framework Application
@ghost

This comment has been minimized.

Copy link

commented Feb 18, 2018

Hi! Tanks for your tutorial! The file one should require at line 132 is settings.php, not config.php, correct?

@odan

This comment has been minimized.

Copy link
Owner Author

commented Feb 21, 2018

@paulocastilho Yes, thanks! I fixed the filename to settings.php.

@DigiLive

This comment has been minimized.

Copy link

commented Feb 22, 2018

I'm a bit confused about deploying...
You mention folder "public" should be the DocumentRoot of Apache.
Taking this in consideration, your "public" folder is my "public_html" folder. All other folder are in place, relative to this one.
But then, whats the use of the .htaccess file in the project root since the project root cannot be reached from the outside?

.
├── project
│ └── config Configuration files
│ └── public_html Web server files (DocumentRoot)
│ └── .htaccess Apache redirect rules for the front controller
│ └── index.php The front controller
│ └── templates Twig templates
│ └── src PHP source code (The App namespace)
│ └── vendor Reserved for composer
.htaccess Internal redirect to the public/ directory
│ .gitignore Git ignore rules

@odan

This comment has been minimized.

Copy link
Owner Author

commented Feb 23, 2018

@fcools

The .htaccess file in the project root is required in at least two cases.

  1. for the development environment.
    For example, if you are developing with XAMPP, you have only one host and several subdirectories. So that Slim runs in this environment without additional setup, this file was created. This simplifies the entire development environment, as you can easily manage any number of applications at the same time.

  2. in case your application is deployed within subfolders of the vhost. (I've seen that many times before).

If none of these cases apply to you, you can also delete this file. But I wouldn't recommend it.

@spartandeveloper

This comment has been minimized.

Copy link

commented Feb 26, 2018

thank you.. this help me to clarify what I'm doing wrong... yes! the official documentation is not excellent..

@peter279k

This comment has been minimized.

Copy link

commented Mar 13, 2018

I usually use the Slim Skeleton to get started with the first Slim application.

@ldigital

This comment has been minimized.

Copy link

commented Mar 25, 2018

Great tutorial. Thank you very much! This should have been on the official Slim site.

@tayron

This comment has been minimized.

Copy link

commented Apr 13, 2018

Hello,

How can I use Logger to write message?
Missing an example...

@omysurya

This comment has been minimized.

Copy link

commented May 31, 2018

Great idea & nice tutorial for newbie.. thanks bro..

@ffuentese

This comment has been minimized.

Copy link

commented May 31, 2018

Is there any example app using this exact configuration? I'd like to check it out.

@odan

This comment has been minimized.

Copy link
Owner Author

commented Jun 12, 2018

@ffuentese Here is the example application: https://github.com/odan/prisma

@darkalchemy

This comment has been minimized.

Copy link

commented Feb 2, 2019

I think that the variable is not being using in time.twig. I am new to slim and twig, so I can not see how to show the time.

I change to Current time: {{ viewData.now }} but that is not working. Obviously I am doing it wrong, could you tell me how to do it correctly?

Thanks

*** UPDATE ***
After a bit more googling, I found the answer Current time: {{ now }}.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.