Installing the Slim Framework
You can manually install the Slim Framework for PHP on your hosting.com account.Although hosting.com servers are compatible with a wide variety of software applications, we cannot provide troubleshooting assistance for application-specific issues.
- Download the Slim Framework at https://github.com/codeguy/Slim/zipball/master to your computer.
- Extract the .zip file on your computer. You should now have a folder named codeguy-Slim-bc5f5a8 (or a similar name).
- Use FTP to upload the contents of the codeguy-Slim-bc5f5a8 folder (but not the codeguy-Slim-bc5f5a8 folder itself) to the public_html directory of your hosting.com account. For more information about how to access your account using FTP, please see this article.
📘 Note Alternatively, you can upload the Slim Framework files to a subdirectory located beneath the public_html directory. If you do this, make sure your PHP script files use the correct path to the Slim Framework subdirectory.
- Use a web browser to go to your website’s URL, such as
http://www.example.com, where example.com represents your domain name. You should see the Welcome to Slim page.
Running a test application
Now that you have the Slim Framework installed, let’s run a quick test application. To do this, follow these steps:- Create a file named slimtest.php in your account’s public_html directory.
- Copy and paste the following sample code into the slimtest.php file:
📘 Note This code sample assumes that you uploaded the Slim Framework files to the public_html directory, which contains the Slim subdirectory. If you uploaded the Slim Framework to another directory, make sure you modify the path in the require statement.
- Use a web browser to go to the URLhttp://www.example.com/slimtest.php/hello/world, where_example.com_ represents your domain name. You should see Hello, world.
👍 Tip As you may have noticed, the trailing part of the URL is handled as a variable. Therefore, you can type anything you want after the /hello/ section, and it will display in the browser.
More information
- For general information about the Slim Framework, please visit http://www.slimframework.com.
- To view the online documentation for the Slim Framework, please visit http://docs.slimframework.com.