Skip to content

Commit 8e098b3

Browse files
authored
Merge pull request #2600 from flow-php/blog-post-api-consumption
2 parents 99c4a01 + b06834d commit 8e098b3

38 files changed

Lines changed: 1972 additions & 128 deletions

web/landing/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ build/
44
vendor/
55
var/
66
public/assets
7+
public/images/blog/social/
8+
public/images/work-shop/social/
79
public/pagefind
810
public/*.xml
911
!public/BingSiteAuth.xml

web/landing/config/bundles.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
return [
46
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],

web/landing/config/preload.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
if (\file_exists(\dirname(__DIR__) . '/var/cache/prod/Flow_Website_KernelProdContainer.preload.php')) {
46
require \dirname(__DIR__) . '/var/cache/prod/Flow_Website_KernelProdContainer.preload.php';

web/landing/config/services.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,28 @@ services:
3939
arguments:
4040
$githubToken: '%env(GITHUB_TOKEN)%'
4141

42+
# curl-based clients segfault in php-fpm on macOS (system proxy lookup via
43+
# fork-unsafe Network.framework), so avatar fetching uses the stream-based client.
44+
social_card.http_client:
45+
class: Symfony\Component\HttpClient\NativeHttpClient
46+
47+
Flow\Website\SocialCard\AvatarCache:
48+
arguments:
49+
$httpClient: '@social_card.http_client'
50+
$cacheDir: '%kernel.project_dir%/var/avatars'
51+
52+
Flow\Website\SocialCard\CardPainter:
53+
arguments:
54+
$resourcesDir: '%kernel.project_dir%/resources'
55+
56+
Flow\Website\SocialCard\Blog\CardGenerator:
57+
arguments:
58+
$publicDir: '%kernel.project_dir%/public'
59+
60+
Flow\Website\SocialCard\WorkShop\CardGenerator:
61+
arguments:
62+
$publicDir: '%kernel.project_dir%/public'
63+
4264
Flow\Website\StaticSourceProvider\:
4365
resource: '../src/Flow/Website/StaticSourceProvider/'
4466
tags: ['static_content_generator.source_provider']
74.5 KB
Binary file not shown.
74.7 KB
Binary file not shown.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Copyright 2018 The Cabin Project Authors (https://github.com/impallari/Cabin.git)
2+
3+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+
This license is copied below, and is also available with a FAQ at:
5+
https://openfontlicense.org
6+
7+
8+
-----------------------------------------------------------
9+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+
-----------------------------------------------------------
11+
12+
PREAMBLE
13+
The goals of the Open Font License (OFL) are to stimulate worldwide
14+
development of collaborative font projects, to support the font creation
15+
efforts of academic and linguistic communities, and to provide a free and
16+
open framework in which fonts may be shared and improved in partnership
17+
with others.
18+
19+
The OFL allows the licensed fonts to be used, studied, modified and
20+
redistributed freely as long as they are not sold by themselves. The
21+
fonts, including any derivative works, can be bundled, embedded,
22+
redistributed and/or sold with any software provided that any reserved
23+
names are not used by derivative works. The fonts and derivatives,
24+
however, cannot be released under any other type of license. The
25+
requirement for fonts to remain under this license does not apply
26+
to any document created using the fonts or their derivatives.
27+
28+
DEFINITIONS
29+
"Font Software" refers to the set of files released by the Copyright
30+
Holder(s) under this license and clearly marked as such. This may
31+
include source files, build scripts and documentation.
32+
33+
"Reserved Font Name" refers to any names specified as such after the
34+
copyright statement(s).
35+
36+
"Original Version" refers to the collection of Font Software components as
37+
distributed by the Copyright Holder(s).
38+
39+
"Modified Version" refers to any derivative made by adding to, deleting,
40+
or substituting -- in part or in whole -- any of the components of the
41+
Original Version, by changing formats or by porting the Font Software to a
42+
new environment.
43+
44+
"Author" refers to any designer, engineer, programmer, technical
45+
writer or other person who contributed to the Font Software.
46+
47+
PERMISSION & CONDITIONS
48+
Permission is hereby granted, free of charge, to any person obtaining
49+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+
redistribute, and sell modified and unmodified copies of the Font
51+
Software, subject to the following conditions:
52+
53+
1) Neither the Font Software nor any of its individual components,
54+
in Original or Modified Versions, may be sold by itself.
55+
56+
2) Original or Modified Versions of the Font Software may be bundled,
57+
redistributed and/or sold with any software, provided that each copy
58+
contains the above copyright notice and this license. These can be
59+
included either as stand-alone text files, human-readable headers or
60+
in the appropriate machine-readable metadata fields within text or
61+
binary files as long as those fields can be easily viewed by the user.
62+
63+
3) No Modified Version of the Font Software may use the Reserved Font
64+
Name(s) unless explicit written permission is granted by the corresponding
65+
Copyright Holder. This restriction only applies to the primary font name as
66+
presented to the users.
67+
68+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+
Software shall not be used to promote, endorse or advertise any
70+
Modified Version, except to acknowledge the contribution(s) of the
71+
Copyright Holder(s) and the Author(s) or with their explicit written
72+
permission.
73+
74+
5) The Font Software, modified or unmodified, in part or in whole,
75+
must be distributed entirely under this license, and must not be
76+
distributed under any other license. The requirement for fonts to
77+
remain under this license does not apply to any document created
78+
using the Font Software.
79+
80+
TERMINATION
81+
This license becomes null and void if any of the above conditions are
82+
not met.
83+
84+
DISCLAIMER
85+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+
OTHER DEALINGS IN THE FONT SOFTWARE.
153 KB
Loading

web/landing/src/Flow/Website/Blog/Post.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use function Flow\Types\DSL\type_string;
1010
use function Flow\Types\DSL\type_structure;
11+
use function sprintf;
1112

1213
final readonly class Post
1314
{
@@ -16,6 +17,7 @@ public function __construct(
1617
public string $description,
1718
public DateTimeImmutable $date,
1819
public string $slug,
20+
public string $author,
1921
) {}
2022

2123
public static function fromArray(array $data): self
@@ -25,8 +27,25 @@ public static function fromArray(array $data): self
2527
'description' => type_string(),
2628
'date' => type_string(),
2729
'slug' => type_string(),
30+
'author' => type_string(),
2831
])->assert($data);
2932

30-
return new self($data['title'], $data['description'], new DateTimeImmutable($data['date']), $data['slug']);
33+
return new self(
34+
$data['title'],
35+
$data['description'],
36+
new DateTimeImmutable($data['date']),
37+
$data['slug'],
38+
$data['author'],
39+
);
40+
}
41+
42+
public function authorAvatarUrl(int $size = 96): string
43+
{
44+
return sprintf('https://github.com/%s.png?size=%d', $this->author, $size);
45+
}
46+
47+
public function authorUrl(): string
48+
{
49+
return 'https://github.com/' . $this->author;
3150
}
3251
}

web/landing/src/Flow/Website/Blog/Posts.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,42 @@ final class Posts
2020
'description' => 'Learn how to extract data from Google Analytics API using Flow PHP but also how to build a custom data extractor.',
2121
'date' => '2024-04-04',
2222
'slug' => 'building-custom-extractor-google-analytics',
23+
'author' => 'norberttech',
2324
],
2425
[
2526
'title' => 'Scalar Functions',
2627
'description' => 'Scalar functions are one of the most important building blocks of Flow. Learn how to build and use custom scalar functions in Flow PHP.',
2728
'date' => '2024-08-08',
2829
'slug' => 'scalar-functions',
30+
'author' => 'norberttech',
2931
],
3032
[
3133
'title' => 'Data processing in PHP',
3234
'description' => 'Processing datasets is a common problem in almost any software. Learn how to process datasets in PHP just like it\'s being done in other programming languages.',
3335
'date' => '2025-01-25',
3436
'slug' => 'data-processing-in-php',
37+
'author' => 'norberttech',
3538
],
3639
[
3740
'title' => 'Flow PHP Release Cycle',
3841
'description' => 'Explanation of the updated Flow PHP release cycle that improves adaptability of new features.',
3942
'date' => '2025-03-16',
4043
'slug' => 'flow-php-release-cycle',
44+
'author' => 'norberttech',
4145
],
4246
[
4347
'title' => 'Flow PHP - Release 0.41.0',
4448
'description' => 'Summary of things changed in Flow PHP 0.41.0 release',
4549
'date' => '2026-06-29',
4650
'slug' => 'flow-php-release-0410',
51+
'author' => 'norberttech',
4752
],
4853
[
4954
'title' => 'Performance Optimizations',
5055
'description' => 'Floe is a dedicated binary format, created to speedup serialization and reduce serialized content size of Rows.',
5156
'date' => '2026-07-23',
5257
'slug' => 'performance-optimizations',
58+
'author' => 'norberttech',
5359
],
5460
];
5561

@@ -58,7 +64,7 @@ final class Posts
5864
*/
5965
public function all(): array
6066
{
61-
return array_map(static fn(array $data): Post => Post::fromArray($data), array_reverse($this->posts));
67+
return array_map(Post::fromArray(...), array_reverse($this->posts));
6268
}
6369

6470
public function findByDateAndSlug(string $date, string $slug): Post

0 commit comments

Comments
 (0)