npx tailwindcss -i ./assets/css/input.css -o ./public/css/output.css --watch
cd into public_html then run: php -S localhost:8080 router.php
$db = new App\Service\Database;
$pdo = $db->getConnection();
// Now you are free to use $db
project-root/ ├── public/ ← Public web root (index.php, css, js, images) ├── src/ ← PHP source code (controllers, app logic) ├── templates/ ← Your view/template files live here (Twig, PHP, etc) ├── vendor/ ← Composer dependencies ├── assets/ ← Source assets (e.g. Tailwind input.css) ├── composer.json └── ... # Use the set file path constants require VIEW_PATH . '/partials/header.php'; require APP_PATH . '/Helpers/functions.php'; PUBLIC_PATH BASE_PATH
# Best practices when linking to files
- When linking SVGs use file_get_contents. NOT requrie!
<?= file_get_contents(PUBLIC_PATH . '/assets/icons/logo.svg'); ?>
- Use src for images.
<img src="<?= BASE_URL ?>/assets/images/red-jb-logo.png" alt="" class="flex md:hidden h-10">
- Use require for php files
Use this skeleton application to quickly setup and start working on a new Slim Framework 4 application. This application uses the latest Slim 4 with Slim PSR-7 implementation and PHP-DI container implementation. It also uses the Monolog logger.
This skeleton application was built for Composer. This makes setting up a new Slim Framework application quick and easy.
Run this command from the directory in which you want to install your new Slim Framework application. You will require PHP 7.4 or newer.
composer create-project slim/slim-skeleton [my-app-name]Replace [my-app-name] with the desired directory name for your new application. You'll want to:
- Point your virtual host document root to your new application's
public/directory. - Ensure
logs/is web writable.
To run the application in development, you can run these commands
cd [my-app-name]
composer startOr you can use docker-compose to run the app with docker, so you can run these commands:
cd [my-app-name]
docker-compose up -dAfter that, open http://localhost:8080 in your browser.
Run this command in the application directory to run the test suite
composer testThat's it! Now go build something cool.