New Website From Scratch

Follow this exact prompt series and build a complete, professional PHP website. Each prompt is copy-pasteable. By the end you will have a real, working website.

Beginner 2-4 hours project Lesson 10 of 20

Before You Start

We are building a professional service business website. Adapt the content to whatever business or project you have in mind.

Setup prompt - run this first
> I am building a new PHP website for a software development company called
  "Ruban Softwares" based in Trichy, India.

  Create the project folder structure:
  /
  ├── index.php           (homepage)
  ├── about.php
  ├── services.php
  ├── contact.php
  ├── blog/index.php
  ├── config/
  │   ├── db.php          (PDO database connection)
  │   └── site.php        (site name, contact info, constants)
  ├── includes/
  │   ├── header.php      (HTML head + navigation)
  │   └── footer.php      (footer + scripts)
  └── assets/
      ├── css/style.css
      └── js/main.js

  Create a CLAUDE.md with the project description and stack:
  PHP 8.2, MySQL 8, Bootstrap 5.3, no frameworks.

  Create all the empty files with appropriate placeholder content.

Phase 1: Foundation

Prompt 2 - Config files
> Create config/site.php with these constants:
  SITE_NAME = 'Ruban Softwares'
  SITE_TAGLINE = 'Delivering Digital Excellence'
  SITE_EMAIL = 'info@rubansoftwares.com'
  SITE_PHONE = '+91 98765 43210'
  SITE_ADDRESS = 'Trichy, Tamil Nadu, India'
  BASE_URL = 'http://localhost/rubansoftwares/'

  And config/db.php with a PDO connection using:
  host=localhost, db=rubansoftwares, charset=utf8mb4
  Credentials read from environment variables DB_USER and DB_PASS.
Prompt 3 - Header
> Create includes/header.php with:
  - Full HTML5 document head (charset UTF-8, viewport meta, Bootstrap 5.3 CDN)
  - Bootstrap navbar with:
    - Logo (SITE_NAME constant) on the left
    - Nav links: Home, About, Services, Blog, Contact
    - Active class on current page (use $_SERVER['PHP_SELF'])
    - Hamburger menu that works on mobile
  - The file starts with require_once('../config/site.php')
  - Include an $page_title variable in the title tag
Prompt 4 - Footer
> Create includes/footer.php with:
  - 3-column Bootstrap footer:
    Column 1: Company name, tagline, social media icons (Facebook, LinkedIn, Twitter)
    Column 2: Quick Links (same as navbar)
    Column 3: Contact info (phone, email, address from constants)
  - Copyright: "© 2025 Ruban Softwares. All Rights Reserved."
  - Bootstrap JS CDN
  - Custom JS file link: assets/js/main.js
Prompt 5 - CSS foundation
> Create assets/css/style.css with:
  - CSS variables: --primary: #1a56db, --secondary: #6c757d, --dark: #0f172a
  - Override Bootstrap's primary color to use --primary
  - Hero section: full-width gradient background, centered text, padding 100px
  - Card hover effect: slight lift with shadow
  - Smooth scroll behavior
  - Footer: dark background (#0f172a), white text
  - Section padding: 80px top/bottom consistently

Phase 2: Pages

Prompt 6 - Homepage
> Build index.php (homepage) with:
  - Hero section: headline "Delivering Digital Excellence", subheadline,
    two buttons: "View Services" and "Contact Us"
  - Services preview: 4 cards (Web Development, Mobile Apps, Cloud Solutions, AI Integration)
    each with icon (Bootstrap Icons), title, 2-line description
  - Why Choose Us: 3 columns with icon + heading + text
    (10+ Years Experience, 200+ Projects, 24/7 Support)
  - Recent Blog Posts: placeholder for 3 cards (we will fill from DB later)
  - CTA Section: full-width colored bar, "Ready to start?" headline, "Get a Quote" button

  Include header.php and footer.php. Use $page_title = 'Home - SITE_NAME'
Prompt 7 - About page
> Build about.php with:
  - Page hero: "About Us" heading with breadcrumb
  - Company story section: 2 columns (text left, placeholder image right)
    Text: founding year 2015, mission statement, vision
  - Team section: 4 team member cards with photo placeholder,
    name, role, LinkedIn icon link
  - Stats bar: 4 counters (200+ Projects, 50+ Clients, 10+ Years, 15+ Team Members)
    with animated count-up effect using JavaScript
  - Values section: 6 values with icons (Integrity, Innovation, Quality, etc.)
Prompt 8 - Services page
> Build services.php with:
  - Page hero with breadcrumb
  - Services grid: 6 service cards in a 3-column grid, each with:
    icon, title, 3-line description, "Learn More" button
    Services: Web Development, Mobile Apps, E-commerce, Cloud Solutions,
    AI/ML Integration, Digital Marketing
  - Process section: 4 numbered steps (Discovery, Design, Development, Deployment)
    each with icon and 2-line description
  - Pricing teaser: 3 plan cards (Basic, Professional, Enterprise)
    with price placeholder and "Contact for Quote" button
Prompt 9 - Contact page
> Build contact.php with:
  - Page hero with breadcrumb
  - 2-column layout:
    Left: contact form (Name, Email, Phone, Service dropdown, Message textarea, Submit)
    Right: contact info card (address, phone, email, business hours, Google Maps embed placeholder)
  - Form processing PHP at top:
    - Validate all fields
    - Save to contacts table: id, name, email, phone, service, message, created_at, ip_address
    - Show success/error message
    - Use POST/Redirect/GET pattern to prevent resubmission
  - Create the SQL: CREATE TABLE contacts ...

  Database connection from config/db.php

Phase 3: Features

Prompt 10 - Blog system
> Build a simple blog system:

CREATE TABLE posts (
  id INT AUTO_INCREMENT PRIMARY KEY,
  title VARCHAR(255) NOT NULL,
  slug VARCHAR(255) UNIQUE NOT NULL,
  excerpt TEXT,
  content LONGTEXT,
  featured_image VARCHAR(255),
  category VARCHAR(100),
  author VARCHAR(100) DEFAULT 'Admin',
  status ENUM('draft','published') DEFAULT 'draft',
  published_at DATETIME,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)

blog/index.php: Blog listing page
  - Show published posts, 6 per page
  - Category filter buttons at top
  - Each post card: image, category badge, title, excerpt, date, "Read More"
  - Pagination

blog/post.php?slug=:
  - Single post page
  - Previous/Next post navigation
  - Related posts (same category, max 3)
Prompt 11 - Admin for blog posts
> Create a simple password-protected admin panel at admin/:
  - admin/login.php: username/password form
    Credentials hardcoded in config/site.php (ADMIN_USER, ADMIN_PASS as hash)
    Creates session on success, redirects to admin/index.php

  - admin/index.php: list all blog posts (title, status, date, Edit/Delete buttons)

  - admin/post-form.php: create/edit post form
    (title, slug auto-generated from title via JS, excerpt, content textarea,
     category, status, published_at, file upload for featured image)

  - admin/delete.php: delete post (POST only, with confirmation)

  All admin pages check session, redirect to login if not authenticated.

Phase 4: Polish

Prompt 12 - SEO meta tags
> Update includes/header.php to support SEO variables.
  Each page sets these before requiring header.php:
  $page_title, $meta_desc, $meta_keywords, $og_image, $canonical_url

  Add to the HTML head:
  -  using $meta_desc
  -  using $meta_keywords
  - Open Graph tags: og:title, og:description, og:image, og:type, og:url
  - Twitter card tags
  -  using $canonical_url

  Set sensible defaults if variables are not set.
Prompt 13 - Performance and security
> Add security and performance improvements:

  1. Create .htaccess with:
     - Redirect HTTP to HTTPS
     - Clean URLs (remove .php extension)
     - Deny access to /config/, /includes/, .env files
     - Enable gzip compression
     - Set cache headers for assets (1 year for CSS/JS/images)

  2. Add CSRF protection to the contact form:
     - Generate token in session
     - Verify on form submission

  3. Add rate limiting to contact form:
     - Max 3 submissions per IP per hour
     - Track in a rate_limits table

Full Prompt Reference

Quick reference of all 13 prompts in order:

#PromptOutput
1Project structure + CLAUDE.mdAll empty files created
2Config filesconfig/site.php + config/db.php
3Headerincludes/header.php
4Footerincludes/footer.php
5CSS foundationassets/css/style.css
6Homepageindex.php
7About pageabout.php
8Services pageservices.php
9Contact form + DBcontact.php + SQL
10Blog systemblog/index.php + post.php + SQL
11Blog admin paneladmin/ (login, list, form, delete)
12SEO meta tagsUpdated header.php
13Security + performance.htaccess + CSRF + rate limit
Substitute your own project details throughout

Replace "Ruban Softwares" with your project name, replace the service categories with your actual services, and replace all placeholder content with real content as you go. The prompts work for any service business, portfolio, or informational website.

Frequently Asked Questions

A 5-page informational website (home, about, services, blog, contact) using this prompt series takes 2-4 hours for a beginner (most time is spent reviewing and testing AI output). A solo developer who already knows the process can complete the same site in under an hour. This compares to 3-7 days of manual coding.

This lesson uses a service business website as the example - applicable to any professional website (restaurant, agency, consultancy, portfolio). The prompts are written generically enough that you can substitute your own content and use case throughout.

Yes for PHP. Install XAMPP (Windows/Mac) or Laragon (Windows) - both are free and set up Apache + PHP + MySQL in one package. For a pure HTML/CSS/JavaScript site, you can open the files directly in the browser without a server.