nititech / php-vite-starter

A modern vanilla PHP-Vite starter repo, utilizing vite-plugin-php
https://github.com/nititech/php-vite-starter
MIT License
18 stars 1 forks source link
development php php7 php8 starter starter-kit starter-template vite vite-php vite-plugin-php vitejs website

PHP-Vite Starter Repo

php-vite-starter is a modern vanilla PHP-Vite starter repository designed to provide developers with the essential tools to kickstart their development of modern PHP applications.\ This repository utilizes Vite and the vite-plugin-php plugin to improve developer experience and provide various features to streamline development.

Features

Usage

  1. Clone the Repository: Start by cloning this repository to your local machine.
git clone https://github.com/nititech/php-vite-starter.git
  1. Install Dependencies: Navigate into the project directory and install the necessary dependencies using npm or yarn.
cd php-vite-starter
npm install
npm run php-install

Development

  1. Start the development server, just run the following command:
npm run dev

Now you can access your application. Once the server is running, you can access your application by navigating to http://localhost:3000/ in your web browser.

Project Structure

/bin
├── bin
│   ├── composer.phar
│   ├── **/*
/index.php

This is the new entry point ⚠️

/pages
├── pages
│   ├── **/*.php
/partials
├── partials
│   ├── **/*.php
/public
├── public
│   ├── **/*
/raw
├── raw
│   ├── .htaccess
│   ├── **/*
/src
├── src
│   ├── scripts
│   │   ├── **/*
│   ├── styles
│   │   ├── **/*
/system
├── system
│   ├── **/*
/vendor
├── vendor
│   ├── **/*

Production Build

To generate a production build of your project, use:

npm run build

Output

All files will be generated and copied into the /dist folder.

├── dist
│   ├── pages (Publicly accessible by name without .php file extension)
│   │   ├── **/* (Transpiled PHP files from your ./pages folder)
│   │
│   ├── partials
│   │   ├── **/* (Transpiled PHP files from your ./partials folder)
│   │
│   ├── public (Publicly accessible files, usually assets)
│   │   ├── **/* (Files copied from the ./src/public folder)
│   │
│   ├── system
│   │   ├── **/* (Files copied from the ./system folder)
│   │
│   ├── vendor
│   │   ├── **/* (Files copied from the ./vendor folder, usually Composer packages)
│   │
│   ├── .htaccess
│   ├── **/* (Files copied from the ./raw folder)

Configuration

This starter repository comes with default configurations for various tools. However, you can customize these configurations according to your project requirements. Key configuration files include:

License

This project is licensed under the MIT license, see LICENSE.

Contributing

Contributions are welcome! If you have any suggestions, improvements, or bug fixes, please feel free to open an issue or submit a pull request.

via Ko-Fi Buy me a coffee via PayPal
ko-fi Buy Me A Coffee PayPal

Acknowledgments

Special thanks to the developers of Vite, Tailwind CSS, and other tools used in this starter repository for their fantastic work.