Skip to content

Instantly share code, notes, and snippets.

View Natshah's full-sized avatar
💻
Automating the Automated

Rajab Natshah Natshah

💻
Automating the Automated
View GitHub Profile
@phenaproxima
phenaproxima / project-browser-api.md
Last active August 3, 2025 14:13
Project Browser and its API

Let's learn a little bit about how Project Browser works.

You can trust me. Together with @chrisfromredfin, @tim.plunkett, and a lot of other contributors, I have spent the better part of the last year refactoring, rearchitecting, and rewriting most of Project Browser, to try and lift it out of its proof-of-concept roots and turn it into a modernized extension browsing and installation system for Drupal. This, then, is a tour of Project Browser from a developer's perspective.

The thing you need to know about Project Browser is that, despite being a decoupled app, it has no JavaScript API at all. The UI, which is written in Svelte, is completely and totally locked down and cannot be extended. What API surface it has is entirely on the PHP side. So let's talk about what those parts are.

The Project class

The most important class in Project Browser is Project. It is a value object that represents a single project that you can see in the UI. Project Browser takes a pretty expansive definition of what

<?php
define('START', 0);
define('END', 948);
$output_handle = fopen('./projects.csv', 'w');
fputcsv($output_handle, [
'category',
'development status',
'maintained',
'body',
@tienthanh2509
tienthanh2509 / install-openvpn-24.sh
Last active September 3, 2024 09:16
Install OpenVPN 2.4.x on Ubuntu 16.04 Xenial
curl -s https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add -
echo "deb http://build.openvpn.net/debian/openvpn/stable xenial main" > /etc/apt/sources.list.d/openvpn-aptrepo.list
apt update
apt install -y openvpn
@waako
waako / .csscomb.json
Created January 19, 2017 15:51
Gulp workflow for Drupal 8 theme. Includes csscomb for Drupal CSS Code Standards and Sass Lint
{
"exclude": [
".git/**",
"misc/**",
"modules/**",
"profiles/**",
"themes/**",
"node_modules/**",
"bower_components/**"
],
@crittermike
crittermike / ExampleModuleController.php
Last active June 17, 2021 12:55
Example of overriding a route controller in Drupal 8
<?php
/**
* @file
* Contains \Drupal\example_module\Controller\ExampleModuleController.
*/
// THIS FILE BELONGS AT /example_module/src/Controller/ExampleModuleController.php
namespace Drupal\example_module\Controller;
id: example_content
label: Example content
migration_group: example
source:
plugin: example_content
target: db_migration
destination:
plugin: entity:node
process:
type:
<?php
/**
* @file
* Contains \Drupal\example_migrate\Plugin\migrate\source\ExampleContent.
*/
namespace Drupal\example_migrate\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
@omerida
omerida / om_exporter.drush.inc
Last active October 14, 2015 16:49
Export Drupal Nodes to CSV with EntityFieldQuery and PHP 5
<?php
function om_exporter_drush_command() {
$items['export-newest'] = array(
'description' => 'Export Newest Content to CSV',
'aliases' => ['ex-new'],
'callback' => 'om_export_newest',
'arguments' => [
'date' => '',
]
@jonathanfranks
jonathanfranks / FormContext.php
Created August 12, 2015 15:05
Behat CKEditor
/**
* @Then /^I fill in wysiwyg field "([^"]*)" with "([^"]*)"$/
*/
public function iFillInWysiwygOnFieldWith($locator, $value) {
$el = $this->getSession()->getPage()->findField($locator);
$fieldId = $el->getAttribute('id');
if (empty($fieldId)) {
throw new Exception('Could not find an id for field with locator: ' . $locator);
}
{
"name": "mynamespace/myproject",
"description": "Composer file example",
"repositories": [
{
"type": "composer",
"url": "http://drupal-packagist.webflo.io/"
},
{
"type": "package",