Skip to content

gupta-8/incredible-portfolio

Repository files navigation

Incredible Portfolio (PHP)

A modern, framework-free PHP portfolio β€” tiny router, reusable layout, responsive UI, and a secure contact form.
Zero external PHP dependencies β€’ Deploy anywhere PHP runs πŸš€

PHP Framework License


Highlights

  • Lightweight: plain PHP, no frameworks
  • Simple routing: index.php?page=home|projects|about|contact
  • Reusable layout: shared header.php / footer.php
  • Easy content editing: update one data/projects.php array
  • Secure contact form: CSRF token + server-side validation
  • Reliable logging: saves messages to storage/messages.csv (and attempts mail() if available)
  • Modern UI: responsive layout, clean cards, accessible colors

Requirements

  • PHP 8.0+
  • A server that can run PHP (local PHP server, shared hosting, VPS, etc.)
  • Write permission for /storage (for saving contact messages)

Quick Start

Run locally

From the project root:

php -S localhost:8000

Open:

http://localhost:8000

Project Structure

incredible-portfolio/
β”œβ”€ index.php           # Router (whitelists pages)
β”œβ”€ config.php          # Site config: name, tagline, owner, contact_email
β”œβ”€ functions.php       # Helpers: config(), e(), CSRF, mail, save_message
β”œβ”€ header.php          # Shared header/layout (top)
β”œβ”€ footer.php          # Shared footer/layout (bottom)
β”œβ”€ assets/
β”‚  β”œβ”€ css/
β”‚  β”‚  └─ style.css
β”‚  β”œβ”€ js/
β”‚  β”‚  └─ main.js
β”‚  └─ img/
β”‚     └─ preview.png   # Add your screenshot here
β”œβ”€ pages/
β”‚  β”œβ”€ home.php
β”‚  β”œβ”€ projects.php
β”‚  β”œβ”€ about.php
β”‚  └─ contact.php
β”œβ”€ data/
β”‚  └─ projects.php     # Your projects array
β”œβ”€ storage/
β”‚  └─ messages.csv     # Contact form CSV (auto-created)
β”œβ”€ LICENSE
└─ README.md

Customize

1) Update site details

Edit config.php:

return [
  'site_name'     => 'Incredible Portfolio',
  'tagline'       => 'Developer β€’ Builder β€’ Learner',
  'owner'         => 'Your Name',
  'contact_email' => 'you@example.com', // used for mail(); CSV logging is always on
];

2) Add your projects

Edit data/projects.php to update:

  • title
  • description
  • tech
  • links
  • featured

3) Add / remove pages

  • Add a new file inside pages/ (example: pages/services.php)
  • Whitelist it in index.php:
$allowed = ['home', 'projects', 'about', 'contact', 'services'];
  • Add it to navigation (in header.php) if needed

Contact Form

  • Page: pages/contact.php
  • Security: CSRF token + server-side validation
  • Delivery:
    • Always logs to storage/messages.csv
    • Attempts mail() to contact_email (if supported by hosting)

Many hosts restrict mail(). The CSV log is your reliable fallback.
For SMTP, adding a mailer (like PHPMailer) is a great future upgrade.


Deployment

Shared Hosting (cPanel / Plesk)
  • Upload the project where index.php is in the document root
  • Select PHP 8.0+ in hosting settings
  • Ensure /storage is writable
Apache (VPS) β€” Example VirtualHost
<VirtualHost *:80>
  ServerName example.com
  DocumentRoot /var/www/incredible-portfolio

  <Directory /var/www/incredible-portfolio>
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>
Nginx (VPS) β€” Example Server Block
server {
  listen 80;
  server_name example.com;

  root /var/www/incredible-portfolio;
  index index.php;

  location / {
    try_files $uri $uri/ /index.php?$query_string;
  }

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php8.2-fpm.sock; # adjust version/socket
  }
}

Security Notes

Protect /storage (IMPORTANT)

storage/messages.csv contains private messages.
Make sure /storage is not accessible from the public web.

Apache option: block with .htaccess

Create storage/.htaccess:

Require all denied
Deny from all

Nginx option: block with location rule

location ^~ /storage/ {
  deny all;
  return 404;
}

Permissions note

If messages aren’t being saved, it’s usually storage permissions.

  • Ensure /storage is writable by the server user.

License

MIT β€” see LICENSE


Credits

Built with vanilla PHP + HTML + CSS + a little JS.

About

Lightweight PHP portfolio template with simple routing, reusable components, and clean UI. No frameworks, just fast and minimal code.

Topics

Resources

License

Contributing

Security policy

Stars

6 stars

Watchers

0 watching

Forks

Contributors