Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4f1aeb9
Build redesigned homepage
mattstauffer Nov 17, 2026
9771801
Merge remote-tracking branch 'upstream/master' into mes/front-page-re…
mattstauffer Nov 17, 2026
187b95e
Restore css_overwite after merge
mattstauffer Nov 18, 2026
9b4b5a4
Feature the newest released branch on the home page; add 8.6 feature
mattstauffer Nov 18, 2026
2433b91
Use the shared footer stylesheet on release pages
mattstauffer Nov 18, 2026
d08ac22
Move inline SVG icons out of the homepage
mattstauffer Nov 18, 2026
bc4d066
Move the releases page onto the homepage's design system ('2026')
mattstauffer Nov 18, 2026
5139367
Move archive home page to /classic/
mattstauffer Nov 18, 2026
d1b22c1
Apply second round of accessibility audits to new homepage
mattstauffer Nov 18, 2026
ffb2b5a
Tweak contrast on footer timeline
mattstauffer Nov 18, 2026
381cf44
Convert 'latest releases' to permanent (non-dropdown)
mattstauffer Nov 18, 2026
251fb25
Merge branch 'master' into mes/front-page-redesign
mattstauffer Nov 19, 2026
9da9537
Update homepage header theme switcher to match new site-wide theme sw…
mattstauffer Nov 19, 2026
dba96e0
Merge branch 'master' into mes/front-page-redesign
mattstauffer Nov 20, 2026
02ab45a
Remove green status dots; adjust spacing around logo wall and compose…
mattstauffer Nov 24, 2026
7f18932
Tweak some designs for better contrast; test a new hero graf
mattstauffer Nov 24, 2026
6a3398e
Update to use the same icons as the 8.6 release page
mattstauffer Nov 24, 2026
4b070ec
Drop logo wall links; update theme switcher to better match release p…
mattstauffer Nov 24, 2026
949bca0
Make braces usage more consistent in examples
mattstauffer Nov 24, 2026
b980d3f
Expand CSS to multiple lines; add imports to examples; expand release…
mattstauffer Nov 24, 2026
8ca858e
Drop rotate shortcut; replace ellipsis with ASCII
mattstauffer Nov 24, 2026
fcabdf2
Convert example highlighting to match release pages
mattstauffer Nov 24, 2026
400beb3
Update releases on home page to tile instead of wrapping
mattstauffer Nov 24, 2026
6ecfed2
Darken the purple PHP logo, and make it more consistent across dark/l…
mattstauffer Nov 24, 2026
44d761b
Put Elephpant in the footer
mattstauffer Nov 24, 2026
1fc2bfe
Make paper grain noise consistent across release pages and home page
mattstauffer Nov 24, 2026
536e905
Modernize extraction example; customize example list on mobile
mattstauffer Nov 24, 2026
a9fd1a8
Show homepage release link on mobile
mattstauffer Nov 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 12 additions & 65 deletions include/footer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

use phpweb\ProjectGlobals;

// 2026 design pages (see site_header()) render their own layout, so they only
// need the footer, the search modal and the closing tags.
if (site_design() === '2026') {
if (($config['footer'] ?? true) !== false) {
echo fancy_footer($config['footer_credit'] ?? '');
}
require __DIR__ . "/search-modal.inc";
echo "</body>\n</html>\n";
return;
}

?>
</section><!-- layout-content -->
<?php
Expand Down Expand Up @@ -99,71 +110,7 @@ if (($config['footer'] ?? true) !== false) {

<a id="toTop" href="javascript:;"><span id="toTopHover"></span><img width="40" height="40" alt="To Top" src="/images/to-top@2x.png"></a>

<div id="search-modal__backdrop" class="search-modal__backdrop">
<div
role="dialog"
aria-label="Search modal"
id="search-modal"
class="search-modal"
>
<div class="search-modal__header">
<div class="search-modal__form">
<div class="search-modal__input-icon">
<!-- https://feathericons.com search -->
<svg xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
width="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
</div>
<input
type="search"
id="search-modal__input"
class="search-modal__input"
placeholder="Search docs"
aria-label="Search docs"
/>
</div>

<button aria-label="Close" class="search-modal__close">
<!-- https://pictogrammers.com/library/mdi/icon/close/ -->
<svg
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
width="24"
viewBox="0 0 24 24"
>
<path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>
</svg>
</button>
</div>
<div
role="listbox"
aria-label="Search results"
id="search-modal__results"
class="search-modal__results"
></div>
<div class="search-modal__helper-text">
<div>
<kbd>↑</kbd> and <kbd>↓</kbd> to navigate •
<kbd>Enter</kbd> to select •
<kbd>Esc</kbd> to close • <kbd>/</kbd> to open
</div>
<div>
Press <kbd>Enter</kbd> without
selection to search using Google
</div>
</div>
</div>
</div>
<?php require __DIR__ . "/search-modal.inc"; ?>

</body>
</html>
48 changes: 36 additions & 12 deletions include/header.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,35 @@

use phpweb\ProjectGlobals;

$css_files = [
// The 2026 design (see site_header()) brings its own shared stylesheets and
// scripts instead of the classic ones; pages add theirs via 'css' and 'js_files'.
$is2026Design = site_design() === '2026';

$css_files = $is2026Design ? [
'/styles/base.css',
'/styles/components.css',
'/styles/search-modal.css',
] : [
'/fonts/Fira/fira.css',
'/fonts/Font-Awesome/css/fontello.css',
'/styles/theme-base.css',
'/styles/theme-medium.css',
'/styles/search-modal.css',
];

if (isset($config['css'])) {
$css_files = array_merge($css_files, (array) $config['css']);
}

// The fancy footer is the default for classic pages (see footer.inc); load its
// standalone stylesheet everywhere except the release landing pages, which ship
// their own footer styles in php85.css.
if (!in_array('php85.css', $css_files, true) && !in_array('/styles/php85.css', $css_files, true)) {
$css_files[] = '/styles/shared-footer.css';
// (Conditionally) load fonts to support base.css
if (array_intersect(['base.css', '/styles/base.css'], $css_files)) {
array_unshift($css_files, '/fonts/Inter/inter.css', '/fonts/IBM-Plex-Mono/plex-mono.css');
}

// Every page uses the fancy footer (see footer.inc and fancy_footer()).
$css_files[] = '/styles/shared-footer.css';

$CSS = [];
foreach($css_files as $filename) {
// files that do not start with / are assumed to be located in the /styles
// directory
Expand All @@ -30,12 +41,18 @@ foreach($css_files as $filename) {
$CSS[$filename] = @filemtime($path);
}

$js_files = array_merge($is2026Design ? [
'js/ext/FuzzySearch.min.js',
'js/search.js',
'js/keyboard.js',
'js/site-header.js',
'js/copy-code.js',
] : [], $config['js_files'] ?? []);

$JS = [];
if (isset($config["js_files"])) {
foreach($config['js_files'] as $filename) {
$path = ProjectGlobals::getPublicRoot() . '/' . $filename;
$JS[$filename] = @filemtime($path);
}
foreach($js_files as $filename) {
$path = ProjectGlobals::getPublicRoot() . '/' . $filename;
$JS[$filename] = @filemtime($path);
}

if (isset($shortname) && $shortname) {
Expand Down Expand Up @@ -139,7 +156,14 @@ if (!isset($config["languages"])) {
<!-- End Matomo Code -->
<?php } ?>
</head>
<body class="<?php echo $curr; ?> <?php echo $classes; ?>">
<body class="<?php echo $curr; ?> <?php echo $classes; ?><?= $is2026Design ? ' design-2026' : '' ?>">
<?php
// 2026 design pages get the new header and render their own layout.
if ($is2026Design) {
require __DIR__ . '/site-header.inc';
return;
}
?>

<nav class="navbar navbar-fixed-top">
<div class="navbar__inner">
Expand Down
157 changes: 157 additions & 0 deletions include/homepage.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<?php

/*
* Data and markup helpers for the homepage (public/index.php).
*/

use phpweb\Homepage\FeaturedRelease;
use phpweb\Homepage\PackagistStats;
use phpweb\Homepage\ReleaseHistory;
use phpweb\News\NewsHandler;
use phpweb\ProjectGlobals;

require_once __DIR__ . '/branches.inc';
require_once __DIR__ . '/version.inc';

/**
* Branches in active support (not security-only), newest first, each with its
* latest release.
*
* @return list<array{branch: string, version: string, major: string, minor: string}>
*/
function homepage_actively_supported_releases(): array
{
$releases = [];
foreach (get_active_branches(false) as $major => $branches) {
foreach ($branches as $branch => $release) {
if (get_branch_support_state($branch) !== 'stable') {
continue;
}

[, $minor] = explode('.', $branch);
$releases[] = [
'branch' => $branch,
'version' => $release['version'],
'major' => (string) $major,
'minor' => $minor,
];
}
}

usort($releases, fn ($a, $b) => version_compare($b['branch'], $a['branch']));

return $releases;
}

/**
* The newest front page news entry, shown above the latest releases.
*
* @return ?array{title: string, url: string, date: DateTimeImmutable}
*/
function homepage_latest_news(): ?array
{
$entry = (new NewsHandler())->getFrontPageNews()[0] ?? null;
if ($entry === null) {
return null;
}

return [
'title' => $entry['title'],
'url' => preg_replace('~^https?://(www\.)?php\.net/~', '/', $entry['id']),
'date' => new DateTimeImmutable($entry['updated']),
];
}

/**
* The branch featured in the "Meet PHP x.y" card (the newest released branch
* in include/homepage/features.php), with its release dates.
*
* @return array{branch: string, released: ?DateTime, latest: ?string, latest_date: ?DateTime, features: list<array{icon: string, title: string, anchor: string, description: string}>, url: string}
*/
function homepage_featured_release(): array
{
/** @var array<string, list<array{icon: string, title: string, anchor: string, description: string}>> $featureReleases */
$featureReleases = require __DIR__ . '/homepage/features.php';

$branch = FeaturedRelease::branch(
array_map('strval', array_keys($featureReleases)),
get_branch_release_date(...),
new DateTimeImmutable(),
);

$latest = get_current_release_for_branch(...array_map('intval', explode('.', $branch)));
$latestDate = null;
if ($latest !== null) {
[$major] = explode('.', $branch);
$date = $GLOBALS['RELEASES'][$major][$latest]['date']
?? $GLOBALS['OLDRELEASES'][$major][$latest]['date']
?? null;
$latestDate = $date ? new DateTime($date) : null;
}

return [
'branch' => $branch,
'released' => get_branch_release_date($branch),
'latest' => $latest,
'latest_date' => $latestDate,
'features' => $featureReleases[$branch],
'url' => homepage_release_url($branch) ?? '/releases/',
];
}

/**
* Where to read about a branch: its release landing page if it has one,
* otherwise the x.y.0 announcement.
*/
function homepage_release_url(string $branch): ?string
{
$public = ProjectGlobals::getPublicRoot();
if (is_file("$public/releases/$branch/index.php")) {
return "/releases/$branch/";
}

$announcement = 'releases/' . str_replace('.', '_', $branch) . '_0.php';
if (is_file("$public/$announcement")) {
return "/$announcement";
}

return null;
}

/**
* @return array{width: int, releases: list<array{branch: string, label: string, title: string, url: ?string, major: bool, left: int, timestamp: int}>, years: list<array{year: int, left: int}>}
*/
function homepage_release_history(): array
{
$branches = [];
foreach (get_all_branches() as $majorBranches) {
foreach (array_keys($majorBranches) as $branch) {
$branches[] = (string) $branch;
}
}

$history = new ReleaseHistory(
$branches,
require __DIR__ . '/homepage/history-overrides.php',
get_branch_release_date(...),
homepage_release_url(...),
(int) date('Y'),
);

return $history->timeline();
}

/**
* @return array{packages: int, versions: int, downloads: int}
*/
function homepage_packagist_stats(): array
{
return PackagistStats::load(ProjectGlobals::getBackendRoot() . '/packagist-stats.json');
}

function homepage_scribble(string $text): string
{
return '<span class="scribble">' . $text
. '<svg viewBox="0 0 220 14" preserveAspectRatio="none" aria-hidden="true">'
. '<path d="M3 7C54 2 147 3 217 5M20 11C78 7 145 8 192 9"/></svg></span>';
}
Loading