diff --git a/Bridge_API/BridgeAbstract.html b/Bridge_API/BridgeAbstract.html index b3831987..2142ba2c 100644 --- a/Bridge_API/BridgeAbstract.html +++ b/Bridge_API/BridgeAbstract.html @@ -100,7 +100,7 @@
Create a new file in the bridges/
folder (see Folder structure).
The file name must be named according to following specification:
-Examples:
-Site | -Filename | -
---|---|
Wikipedia | -WikipediaBridge.php | -
FacebookBridge.php | -|
GitHub | -GitHubBridge.php | -
Freenews | -FreenewsBridge.php | -
The file must start with the PHP tags and end with an empty line. The closing tag ?>
is omitted.
Example:
+New code files MUST have declare(strict_types=1);
at the top of file:
<?php
- // PHP code here
-// This line is empty (just imagine it!)
+
+declare(strict_types=1);
-The next step is to extend one of the base classes. -Refer to one of an base classes listed on the Bridge API page.
+Create the new bridge in e.g. bridges/BearBlogBridge.php
:
<?php
+
+declare(strict_types=1);
+
+class BearBlogBridge extends BridgeAbstract
+{
+ const NAME = 'BearBlog (bearblog.dev)';
+
+ public function collectData()
+ {
+ $dom = getSimpleHTMLDOM('https://herman.bearblog.dev/blog/');
+ foreach ($dom->find('.blog-posts li') as $li) {
+ $a = $li->find('a', 0);
+ $this->items[] = [
+ 'title' => $a->plaintext,
+ 'uri' => 'https://herman.bearblog.dev' . $a->href,
+ ];
+ }
+ }
+}
+
+Learn more in bridge api.