Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preview implementation of the Laminas ecosystem RFC #226

Open
wants to merge 39 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
da7ec0c
preview implementation of the Laminas ecosystem RFC
Jurj-Bogdan Nov 1, 2024
810aef0
listing page redesign, data refresh cron changes, db no longer regene…
Jurj-Bogdan Nov 19, 2024
c6b5790
listing page design, db tweaks
Jurj-Bogdan Nov 25, 2024
0c5b576
clear filters button
Jurj-Bogdan Nov 25, 2024
4719966
missing image fix, extra heading & navbar changes
Jurj-Bogdan Dec 2, 2024
0325362
JSON validation GitHub workflow
Jurj-Bogdan Dec 10, 2024
3b467e2
jquery replaced with vanilla js
Jurj-Bogdan Dec 13, 2024
b2c5860
package homepage fix
Jurj-Bogdan Dec 13, 2024
d188f98
Lock file maintenance
renovate[bot] Nov 4, 2024
769a70a
Wrong pattern of an URL for a blog article
arhimede Oct 16, 2024
7e64063
add article about October 2024 meeting
arhimede Oct 25, 2024
93ffe62
add article about October 2024 meeting
arhimede Oct 25, 2024
ae72ceb
Fix wrong usage of the GHA context in shell. Improve verbiage
Xerkus Nov 4, 2024
646ac54
Lock file maintenance
renovate[bot] Nov 11, 2024
0dc8ec7
Update dependency laminas/laminas-config-aggregator to ^1.16.0
renovate[bot] Nov 11, 2024
d2f16d2
Update dependency laminas/laminas-config-aggregator to ^1.17.0
renovate[bot] Nov 17, 2024
061cc33
Lock file maintenance
renovate[bot] Nov 18, 2024
1188098
add article about November 2024 meeting
arhimede Nov 15, 2024
019c78f
complete the article with other news
arhimede Nov 15, 2024
6f6a545
removed other news
arhimede Nov 18, 2024
319ac01
Add new article about October developments
gsteel Nov 18, 2024
902e0d2
fix missing extend tag.
arhimede Nov 19, 2024
d939eac
added linting action && fixed linting errors
Jurj-Bogdan Nov 28, 2024
a913a18
linting fix
Jurj-Bogdan Nov 28, 2024
4a7c3f3
reverted first headlines && minor config change
Jurj-Bogdan Nov 28, 2024
bf0f179
laminas-ci linting rules
Jurj-Bogdan Nov 29, 2024
16cfffc
md014 fix & excluded files
Jurj-Bogdan Dec 3, 2024
9aa4e5b
Update Laminas packages (#234)
renovate[bot] Dec 3, 2024
c312918
Lock file maintenance (#235)
renovate[bot] Dec 3, 2024
832c04b
Lock file maintenance
renovate[bot] Dec 9, 2024
8d11b86
Lock file maintenance
renovate[bot] Dec 16, 2024
7e7cf95
Lock file maintenance
renovate[bot] Dec 23, 2024
4741236
Lock file maintenance
renovate[bot] Dec 30, 2024
8b1a593
Lock file maintenance
renovate[bot] Jan 6, 2025
ab35953
Lock file maintenance
renovate[bot] Jan 13, 2025
fcc8c6c
listing page redesign, data refresh cron changes, db no longer regene…
Jurj-Bogdan Nov 19, 2024
3fc424b
package removal logic, psalm fixes, initial unit tests
Jurj-Bogdan Jan 14, 2025
5730358
missing key added
Jurj-Bogdan Jan 14, 2025
0bd2f2d
Merge branch 'staging' into laminas-ecosystem-issue199
Jurj-Bogdan Jan 14, 2025
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
11 changes: 10 additions & 1 deletion .platform.app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ hooks:
echo "- Installing application dependencies"
composer install --no-ansi --no-dev --no-interaction --no-scripts --no-plugins --optimize-autoloader
mkdir -p var/blog/feeds
mkdir -p var/ecosystem
composer build
deploy: |
rm -f data/cache/config-cache.php
Expand Down Expand Up @@ -79,7 +80,15 @@ crons:
./vendor/bin/laminas repository:generate-data "$PLATFORM_VARIABLES" | base64 --decode | jq '."REPO_TOKEN"'
fi
shutdown_timeout: 20

generateecosystem:
# Refresh repository data every 6 hours (UTC).
spec: '* */4 * * *'
commands:
start: |
if [ "$PLATFORM_BRANCH" = master ]; then
./vendor/bin/laminas ecosystem:seed-db
fi
shutdown_timeout: 20
web:
locations:
'/':
Expand Down
51 changes: 51 additions & 0 deletions ADD_ECOSYSTEM_PACKAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Adding your entry to the Laminas Ecosystem

You can add packages **available via composer** to the `data/ecosystem/ecosystem-packages.json` file by following the steps below:

- Entries must use the [template](#new-entry-template) as a guide.
- Submit a PR.

> Use the following command to make sure your submission will be correctly built:

```bash
composer build
```

> The following command can be run individually for testing:

```bash
./vendor/bin/laminas ecosystem:create-db
```

*Used for creating the database.*

```bash
./vendor/bin/laminas ecosystem:seed-db
```

*Used for updating the package data every X hours.*

## New entry template

```json
{
"packagistUrl": "",
"githubUrl": "",
"categories": [],
"homepage": ""
}
```

### New entry fields description

- `packagistUrl` **required**
**string** - the packagist URL of the entry, with no query parameters

- `githubUrl`
**string** - optional link to be displayed on the package card

- `categories`
**array of strings** - user defined keywords used for filtering results

- `homepage`
**string** - optional URL to package homepage, will overwrite "homepage" field from Packagist Api data
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ Everyone is welcome to post a blog entry. Once submitted, it will be reviewed by
If it's rejected, the reason for the rejection will be included, so you can update it and resubmit the post if applicable.

The submission process is described in the [ADD_BLOG_ENTRY](ADD_BLOG_ENTRY.md) file.

## Adding packages to the Laminas Ecosystem

The [ADD ECOSYSTEM PACKAGE](ADD_ECOSYSTEM_PACKAGE.md) file describes the process of adding packages to the [Laminas Ecosystem](https://getlaminas.org/ecosystem)
3 changes: 2 additions & 1 deletion bootstrap/gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ function js() {
'node_modules/@popperjs/core/dist/umd/popper.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/anchor-js/anchor.min.js',
'js/base.js'
'js/base.js',
'js/_ecosystem.js'
]))
.pipe(concat({path: 'laminas.js'}))
.pipe(terser({mangle: false}).on('error', function (e) {
Expand Down
84 changes: 84 additions & 0 deletions bootstrap/js/_ecosystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
'use strict';

$(document).ready(function () {
Copy link
Member

@froschdesign froschdesign Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vanilla JavaScript is good in 2024 and it should be dropped when we move to Bootstrap 5.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I saw jquery was already added as a dependency and went with it, but I'll go ahead and refactor

$('.package-button').click(function (e) {
e.preventDefault();

const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const entry = $(this).data('value');

if ($(this).hasClass('tag')) {
if (! params.has("tags[]", entry)) {
params.append("tags[]", entry);
url.search = params.toString();

window.location.replace(url.toString());
}
}

if ($(this).hasClass('category')) {
if (! params.has("categories[]", entry)) {
params.append("categories[]", entry);
url.search = params.toString();

window.location.replace(url.toString());
}
}
});

$('.ecosystem-filter').click(function (e) {
e.preventDefault();

const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const entry = $(this).data('value');

if ($(this).hasClass('tag')) {
if (params.has("tags[]", entry)) {
params.delete("tags[]", entry);
url.search = params.toString();

window.location.replace(url.toString());
}
}

if ($(this).hasClass('category')) {
if (params.has("categories[]", entry)) {
params.delete("categories[]", entry);
url.search = params.toString();

window.location.replace(url.toString());
}
}
});

[...$('#ecosystem-pagination a')].forEach(a => {
const url = new URL(a.href)
for (let [k,v] of new URLSearchParams(window.location.search).entries()) {
if (k === 'tags[]' || k === 'categories[]' || k === 'q') {
url.searchParams.set(k,v)
}
}
a.href = url.toString();
})

$('#ecosystem-search').keypress(function (e) {
const search = $(this).val();
if (e.which === 13) {
setSearchQuery(search);
}
});

$('#ecosystem-search-btn').click(function (e) {
const search = $('#ecosystem-search').val();
setSearchQuery(search);
});

function setSearchQuery(search) {
const url = new URL(window.location.href);

url.searchParams.set('q', search);
window.location.replace(url.toString());
}
});
86 changes: 86 additions & 0 deletions bootstrap/scss/_custom-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,89 @@ article {
}
}
}

#ecosystem-section {
.tag {
--filter-button-color: #00131e;
}
.category {
--filter-button-color: #678799;
}
#ecosystem-pagination {
margin-top: 1em;
}
}

.ecosystem-container {
display: flex;
flex-direction: column;
gap: 1em;
}

.ecosystem-package {
display: flex;
gap: 1em;

border: 1px solid grey;
border-radius: 5px;

padding: 1em;

.package-name {
font-size: 1.5em;
font-weight: bold;
}

.ecosystem-package-details {
display: flex;
flex-direction: column;
flex: 3;
}
.ecosystem-package-statistics {
flex: 1;
border-left: 1px solid grey;
padding-left: 1em;
}
.statistics-item {
margin-bottom: .5em;
}
}

.package-categories-container, .package-tags-container {
display: flex;
flex-wrap: wrap;
gap: .5em;
margin-bottom: .5em;

.package-button {
border: 2px solid var(--filter-button-color);
border-radius: 5px;
padding: 0 .5em;
color: var(--filter-button-color);
font-weight: bold;
background-color: white;
}
}

#ecosystem-filter-container {
display: flex;
flex-direction: row;
gap: .5em;

.ecosystem-filter {
border-radius: 5px;
color: white;
background-color: var(--filter-button-color);
padding: 0 .5em;
}
}

#ecosystem-search-container {
display: flex;
margin: .5em 0;
max-width: 50%;

#ecosystem-search-btn {
color: #00131e
}
}
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"psr-4": {
"App\\": "src/App/",
"GetLaminas\\Blog\\": "src/Blog/",
"GetLaminas\\Ecosystem\\": "src/Ecosystem/",
"GetLaminas\\ReleaseFeed\\": "src/ReleaseFeed/",
"GetLaminas\\Security\\": "src/Security/"
}
Expand All @@ -87,7 +88,8 @@
"scripts": {
"build": [
"@build-blog",
"laminas security:build"
"laminas security:build",
"laminas ecosystem:create-db"
],
"build-blog": [
"laminas blog:seed-db",
Expand Down
3 changes: 3 additions & 0 deletions config/autoload/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
'blog' => [
'db' => 'sqlite:' . realpath(getcwd()) . '/var/blog/posts.db',
],
'packages' => [
'db' => 'sqlite:' . realpath(getcwd()) . '/var/ecosystem/packages.db',
],
];
1 change: 1 addition & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class_exists(\Mezzio\Swoole\ConfigProvider::class)

// Default App module config
GetLaminas\Blog\ConfigProvider::class,
GetLaminas\Ecosystem\ConfigProvider::class,
GetLaminas\ReleaseFeed\ConfigProvider::class,
GetLaminas\Security\ConfigProvider::class,
App\ConfigProvider::class,
Expand Down
3 changes: 3 additions & 0 deletions config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
// Blog routes
(new GetLaminas\Blog\ConfigProvider())->registerRoutes($app, '/blog');

// Laminas ecosystem routes
(new GetLaminas\Ecosystem\ConfigProvider())->registerRoutes($app);

// Security advisory routes
(new GetLaminas\Security\ConfigProvider())->registerRoutes($app, '/security');

Expand Down
42 changes: 42 additions & 0 deletions data/ecosystem/ecosystem-packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"packagistUrl": "https://packagist.org/packages/akrabat/ip-address-middleware",
"githubUrl": "https://github.com/akrabat/ip-address-middleware",
"categories": ["ip", "address", "middleware"],
"homepage": ""
},
{
"packagistUrl": "https://packagist.org/packages/netglue/laminas-messenger",
"githubUrl": "https://github.com/netglue/laminas-messenger",
"categories": ["laminas", "messenger"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"laminas" does not make sense here, because we need to differentiate between integration in Mezzio-based and/or laminas-mvc-based applications. This means that the package can be used as a:

  • module in a laminas-mvc-based application
  • and/or via a config provider in a Mezzio-based application

Maybe the categories are not suitable for this and a separate entry or entries are required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment the "categories" key is only used for filtering in the interface, so I added a few here and there so they'll be visible in the preview - once a new role is found for them, I can upgrade the functionality to fit the request of course.

Even if the current approach of "user defined keywords" is kept, some other guidelines could be defined for them if wanted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to brainstorm a bit about those possible categories.

"homepage": ""
},
{
"packagistUrl": "https://packagist.org/packages/dotkernel/dot-errorhandler",
"githubUrl": "https://github.com/dotkernel/dot-errorhandler",
"categories": ["error-handling"],
"homepage": "https://dotkernel.com"
},
{
"packagistUrl": "https://packagist.org/packages/roave/psr-container-doctrine",
"githubUrl": "",
"categories": ["middleware", "doctrine"],
"homepage": ""
},
{
"packagistUrl": "https://packagist.org/packages/asgrim/mini-mezzio",
"githubUrl": "https://github.com/asgrim/mini-mezzio",
"categories": ["mezzio"],
"homepage": ""
},
{
"packagistUrl": "https://packagist.org/packages/phly/phly-simple-page",
"categories": [],
"homepage": "https://github.com/phly/PhlySimplePage"
},
{
"packagistUrl": "https://packagist.org/packages/mezzio/mezzio-aurarouter",
"categories": [],
"homepage": ""
}
]
Loading