diff --git a/.gitignore b/.gitignore index f77e3bf79..e2fe585e2 100644 --- a/.gitignore +++ b/.gitignore @@ -25,8 +25,7 @@ yarn-error.log /demo-runner -/resources/json-database/* -!/resources/json-database/references.json +/resources/json-database/rector_runs.json /.env diff --git a/resources/json-database/upcoming_talks.json b/resources/json-database/upcoming_talks.json new file mode 100644 index 000000000..f4ac1cf23 --- /dev/null +++ b/resources/json-database/upcoming_talks.json @@ -0,0 +1,20 @@ +[ + { + "title": "Mastering Automated Refactoring with custom Rector rules - Dave Liddament", + "date": "2025-05-20", + "location": "Chicago, Illinois, USA", + "url": "https://phptek.io/schedule" + }, + { + "title": "Intro to Automated Refactoring with RectorPHP - Chris Abbey", + "date": "2025-05-22", + "location": "Chicago, Illinois, USA", + "url": "https://phptek.io/schedule" + }, + { + "title": "Advanced Rector Shenanigans - Chris Abbey", + "date": "2025-05-22", + "location": "Chicago, Illinois, USA", + "url": "https://phptek.io/schedule" + } +] diff --git a/resources/views/homepage/_parts/posts.blade.php b/resources/views/homepage/_parts/posts.blade.php new file mode 100644 index 000000000..2e8eb6da8 --- /dev/null +++ b/resources/views/homepage/_parts/posts.blade.php @@ -0,0 +1,18 @@ +

Featured Posts

+ +@foreach ($recentPosts as $recentPost) + @php /** @var \App\Entity\Post $recentPost */ @endphp + + +
  • +
    + {{ $recentPost->getTitle() }} + +
    + {{ $recentPost->getDateTime()->format('M j, Y') }} +
    +
    +
  • + +
    +@endforeach diff --git a/resources/views/homepage/_parts/upcoming_talks.blade.php b/resources/views/homepage/_parts/upcoming_talks.blade.php new file mode 100644 index 000000000..cbcfd1293 --- /dev/null +++ b/resources/views/homepage/_parts/upcoming_talks.blade.php @@ -0,0 +1,20 @@ +

    Upcoming Talks

    + +@foreach ($upcomingTalks as $upcomingTalk) + +
  • +
    + {{ $upcomingTalk['title'] }}
    + +
    + {{ date("M j, Y", strtotime($upcomingTalk['date'])) }} +
    +
    + +
    + {{ $upcomingTalk['location'] }} +
    +
  • + +
    +@endforeach diff --git a/resources/views/homepage/homepage.blade.php b/resources/views/homepage/homepage.blade.php index 293729a96..c2061026b 100644 --- a/resources/views/homepage/homepage.blade.php +++ b/resources/views/homepage/homepage.blade.php @@ -14,7 +14,8 @@
    -

    We help successful and growing companies to get the most out of the code they already have.

    +

    We help successful and growing companies to get the most out of the code they + already have.

    Reduce maintenance cost, make feature delivery @@ -37,13 +38,20 @@ class="btn btn-primary">Try It Online

    Trusted by engineers at

    - Curve logo - i6 logo - GotPhoto logo - Ares Travel logo - Media Trust logo - Spaceflow logo - EONX logo + Curve logo + i6 logo + GotPhoto logo + Ares Travel logo + Media Trust logo + Spaceflow logo + EONX logo
    @@ -51,34 +59,39 @@ class="btn btn-primary">Try It Online

    - How does Rector Improve your Business? + How does Rector Improve your Business?

    - Rector is a PHP tool that you can run on any PHP project to get an instant upgrade + Rector is a PHP tool that you can run on any PHP project to get an instant + upgrade or automated refactoring.

    It helps you with: -

      -
    • PHP and framework upgrades,
    • -
    • in-house framework migrations,
    • -
    • improving your code quality to deliver features faster than competition
    • -
    +
      +
    • PHP and framework upgrades,
    • +
    • in-house framework migrations,
    • +
    • improving your code quality to deliver features faster than competition
    • +

    In the hands of an expert, Rector massively reduces your work-time.
    - Where project upgrade PHP 8.0 to 8.4 would take 3 months, Rector is done in 3 days. + Where project upgrade PHP 8.0 to 8.4 would take 3 months, + Rector is done in 3 days.

    - You can learn it yourself from documentation, + You can learn it yourself from documentation, or to save time and start upgrading today, - hire our upgrade team. + hire + our upgrade team.

    @@ -104,42 +117,28 @@ class="img-fluid img-thumbnail"> 90% of problems you'll face are new to you.

    - We've already seen them and know exactly how to solve them cost-effectively + We've already seen them and know exactly how to solve them + cost-effectively and quickly.

    - How does typical codebase renovation look like? + How does typical codebase + renovation look like?

    - - @include('_snippets/homepage_separator') -

    Featured

    - @foreach ($recentPosts as $recentPost) - @php /** @var \App\Entity\Post $recentPost */ @endphp - - -
  • -
    - {{ $recentPost->getTitle() }} - -
    - {{ $recentPost->getDateTime()->format('M j, Y') }} -
    -
    -
  • + @if (count($upcomingTalks) > 0) + @include('homepage/_parts/upcoming_talks') + @include('_snippets/homepage_separator') + @endif -
    - @endforeach + @include('homepage/_parts/posts') @include('_snippets/homepage_separator') diff --git a/src/Controller/HomepageController.php b/src/Controller/HomepageController.php index ccaf08586..67e23d0af 100644 --- a/src/Controller/HomepageController.php +++ b/src/Controller/HomepageController.php @@ -24,6 +24,7 @@ public function __invoke(): View 'recentPosts' => $this->postRepository->fetchLast(5), 'references' => $this->loadReferences(), + 'upcomingTalks' => $this->loadUpcomingTalks(), // seo 'metaTitle' => 'Rector: Fast PHP Code Upgrades & Refactoring', @@ -36,8 +37,19 @@ public function __invoke(): View */ private function loadReferences(): array { - $referencesFileContents = FileSystem::read(__DIR__ . '/../../resources/json-database/references.json'); + $fileContents = FileSystem::read(__DIR__ . '/../../resources/json-database/references.json'); + return Json::decode($fileContents, forceArrays: true); + } + + /** + * @return mixed[] + */ + private function loadUpcomingTalks(): array + { + $fileContents = FileSystem::read(__DIR__ . '/../../resources/json-database/upcoming_talks.json'); + $upcomingTalks = Json::decode($fileContents, forceArrays: true); - return Json::decode($referencesFileContents, forceArrays: true); + // remove past talks + return array_filter($upcomingTalks, static fn (array $talk): bool => $talk['date'] > date('Y-m-d')); } }