A modern PHP-based travel blog application with user profiles, posts, articles, and comments.
- 🏝️ Travel blog posts with rich content
- 👤 User profiles and authentication
- 📝 Article management with image uploads
- 💬 Comment system
- 🔍 Search functionality
- 📱 Responsive design with Bootstrap
- PHP 8.0 or higher
- MySQL 5.7+ or MariaDB 10.2+
- Composer 2.x
composer installThis will:
- Install all PHP dependencies
- Automatically create a
.envfile from.env.exampleif it doesn't exist
Edit the .env file and update your database credentials:
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=travel_blog
DB_USERNAME=root
DB_PASSWORD=your_password_hereRun the database installation script to automatically create the database and import the schema:
composer install-dbThis will:
- Create the
travel_blogdatabase - Import all tables and sample data
- Verify the installation
Start the built-in PHP development server:
composer devThe application will be available at http://localhost:8000
TravelBlogProject/
├── config/ # Configuration files
│ ├── bootstrap.php # Application initialization
│ └── database.php # Database connection
├── database/ # Database files
│ └── travel_blog.sql # Database schema and sample data
├── public/ # Public web root (document root)
│ └── index.php # Application entry point
├── scripts/ # JavaScript and utility scripts
│ ├── install-database.php # Database installer
│ └── ...
├── src/ # PHP source code (PSR-4 autoloaded)
├── static/ # Static assets (CSS, images)
│ ├── css/
│ ├── images/
│ └── scss/
├── templates/ # PHP templates/views
│ ├── core/ # Core templates (navbar, footer)
│ ├── index/ # Home page templates
│ ├── post/ # Post templates
│ ├── profile/ # Profile templates
│ └── ...
├── vendor/ # Composer dependencies (gitignored)
├── .env # Environment configuration (gitignored)
├── .env.example # Example environment configuration
├── composer.json # Composer configuration
└── README.md # This file
composer dev- Start development server on localhost:8000composer install-db- Install/reinstall database with sample data
composer require vendor/package-nameThe application runs in development mode by default with error reporting enabled. To switch to production mode, update .env:
APP_ENV=production
APP_DEBUG=falseThe application uses PDO for database access. Connection is handled automatically through environment variables:
// Get database connection
$conn = getDbConnection();
// Or use legacy function (backward compatible)
$conn = connect();The database includes the following main tables:
user- User accounts and profilespost- Blog postsarticle- Articles within postscomment- User commentsuser_intro- User introductions
- Always keep
.envfile out of version control - Update database credentials before deploying
- Set
APP_DEBUG=falsein production - Review and update security settings in
.env
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request