3.8 KiB
PHP Project
A brief description of your PHP project
Requirements
- PHP: >= 8.0 (recommended: PHP 8.2 or 8.3)
- Extensions: openssl, pdo_mysql, mbstring, json, curl
- Database: MySQL 5.7+ / MariaDB 10.4+ / PostgreSQL 13+
- Web Server: Nginx / Apache / IIS (with FastCGI)
- Composer: Latest version (getcomposer.org)
For Windows users, consider using WSL2 or local stacks like XAMPP/WampServer/Laragon.
Installation
-
Clone the repository
git clone https://github.com/yourusername/yourproject.git cd yourproject
-
Install dependencies via Composer
composer install
-
Environment configuration
cp .env.example .env
Edit .env file with your database credentials and other settings.
-
Generate application key (if using Laravel or similar)
php artisan key:generate
-
Run database migrations (if applicable)
php artisan migrate
Configuration
Key configuration files:
.env- Environment variables (database, API keys, app settings)config/app.php- Application-level configurationconfig/database.php- Database connection settingsphp.ini- PHP runtime settings
PHP INI recommendations for production:
memory_limit = 256M upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300 date.timezone = UTC opcache.enable = 1 opcache.memory_consumption = 128
Usage
Development server (quick start):
php -S localhost:8000 -t public
Open browser: http://localhost:8000
Production deployment - Nginx:
server { listen 80; server_name yourdomain.com; root /var/www/yourproject/public; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ .php$ { include fastcgi_params; fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
Production deployment - Apache (.htaccess):
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L]Running scheduled tasks (cron) - Linux:
-
-
-
-
- php /path/to/yourproject/artisan schedule:run >> /dev/null 2>&1
-
-
-
Directory Structure
yourproject/ ├── app/ - Application core logic ├── bootstrap/ - Framework bootstrapping ├── config/ - Configuration files ├── database/ - Migrations and seeds ├── public/ - Public web root (entry point) │ ├── index.php - Front controller │ └── .htaccess - Apache rewrite rules ├── resources/ - Views, assets, language files ├── routes/ - Route definitions ├── storage/ - Logs, cache, file uploads ├── tests/ - Unit and feature tests ├── vendor/ - Composer dependencies ├── .env - Environment configuration ├── composer.json - Project dependencies ├── composer.lock - Locked dependency versions └── README.md - This file
Contributing
- Fork the repository
- Create a feature branch: git checkout -b feature/amazing-feature
- Commit your changes: git commit -m 'Add some amazing feature'
- Push to the branch: git push origin feature/amazing-feature
- Open a Pull Request
Coding Standards:
- Follow PSR-12 coding standards
- Write unit tests for new features
- Update documentation accordingly
License
This project is licensed under the MIT License.
Acknowledgments
Built with love using PHP