Download the PHP package tharindu127/pubba without Composer

On this page you can find all versions of the php package tharindu127/pubba. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pubba

pubba

A small brain for showroom sites. Describe your content once as entities and typed links. pubba gives back:

Every result carries a machine-readable reason ({ kind: "same-stack", to, via: ["Flutter", "Dart"] }) and a sentence rendered from it with templates you can override or translate.

Zero runtime dependencies. ESM. Strict TypeScript. MIT.

pubba is extracted from the guide robot (also called Pubba) on Tharindu Athapaththu's portfolio, where it has run in production on about 160 entities and 350 links. A parity test runs the site's original engine beside the library and checks they give the same links, scores and sentences.

Showroom sites

A portfolio is a showroom: a set of things, connected, that a visitor walks through. So is a product catalogue, a course list or a docs site. The engine doesn't know about any of them: types, link kinds, weights and rules are configuration. Portfolios are the main example and ship as a preset.

Showroom Entities Links
Portfolio (preset) person, project, skill, role, market, platform, game, creative work, topic built-with, shipped-in, made-at, runs-on, same-stack, used-at, used-with, same-series, about, mentions, worked-as, founded
Catalogue product, brand, category, material made-by, made-of, goes-with
Courses course, topic, instructor, level about, taught-by, prerequisite, same-series
Docs page, concept, API, version explains, uses-api, see-also

The site keeps its own design and UI. pubba is the data model and the brain.

Install

Node 22.6+ for the CLI. The library itself runs anywhere modern JavaScript runs, including the browser.

Quick start: a portfolio

Run the fuller example (a fictional portfolio with 8 projects, 15 skills, 3 roles, 5 markets, games and creative work):

Any other site

The schema

Entities: id, type, label, and optionally short (how it reads in a sentence), aliases, text (its own words, read by rules), url, weight (0 to 1: common tools weigh less so they never make two items look alike), mentionAs, data.

Links: from, kind, to, optional weight and via (what the two ends share). A pair keeps only its first link, so the most specific relation wins.

Derived links come from rules in the config, applied in order:

Rule Example
shared Two projects sharing two or more core skills are same-stack
co-occur Two skills used together in two or more projects are used-with
label-prefix "Skyforge Saga" → "Skyforge Saga II" are same-series
named-in A role whose story names a project: the project is made-at that role
topics Any text matching /payment|wallet/ is about Fintech

Full reference: skill/references/schema.md.

Explainable results

The sentence is a rendering of the reason. Templates are keyed by kind, or kind.type for one type, and can branch on direction and on the types at each end:

Tokens: {item}, {other}, {otherLower}, {via}, {kind}, {name}. A [...] part disappears when a token inside it is empty: "{item} goes with {other}[, as in {via}].".

API

createPubba(dataset, config?) Builds the graph once; returns the object below
pubba.related(id, { kinds?, limit?, destinationsOnly?, accept? }) Neighbours, strongest first, each { entity, weight, link, reason, text }
pubba.next(trail, { limit?, exclude?, accept?, intent? }) Predictions { entity, score, reason, text }, leaning towards the visitor's likely intent when intents are configured
pubba.intent(trail) Why the visit is likely happening: { likely, confidence, scores, evidence } (intent profiles)
pubba.autocomplete(typed, trail?, { limit?, accept? }) Type-ahead suggestions
pubba.search(query, { limit?, types? }) Every entity a query could mean, best first
pubba.match(query) { intent: "entity" \| "similar" \| "none", entity, match, similar }
pubba.explain(reason, item, templates?) A reason as a sentence
createTrail({ max?, storage?, key? }) record, get, clear, subscribe
createEvents({ goals? }), createPubba(data, config, { events }) Privacy-safe measurement events; pubba.track.guideOpened / guidedTo / reached
summarise(events) One visit's funnel: usedGuide, guidedTo, reached, guidedBeforeGoal
createGuide(pubba, { trail?, route?, chips?, nudge?, templates?, now?, ai? }) The headless navigator: ask, askAsync (with the site's AI), chips, visited, follow, nudge, opened, reached
compileBundle(graph, { withData? }), loadBundle(json, { events? }) The finished graph as portable JSON, and a runtime from it
buildGraph, predictNext, related, search, match, autocomplete, renderReason, mergeConfig The same, as functions over a Graph
normalize, editDistance, closeTo, hasPhrase, mentions The text helpers behind matching
pubba.graph.unlinked Entities with no links: never suggested, but match and search still find them
pubba/portfolio portfolioConfig, portfolioTemplates, fromPortfolio, PORTFOLIO_TOPICS, PORTFOLIO_INTENTS, APP_CATEGORY, skillWeight, callName
pubba/eval evaluate, evaluateQueries, evaluateTrails, evaluateIntents, regressions, formatReport, generateCases, lint, formatLint
pubba/exports toJsonLd, validateJsonLd, toLlmsTxt, toKnowledge, toSitemapEntries, toSitemapXml
pubba/ai createAI, claude, openai, gemini, remoteAI, aiSystemPrompt, ANSWER_SCHEMA (the site's AI)

Matching options (config.match)

Option Effect
typoMinLength Words shorter than this must be spelled right ("hire" isn't the skill Hive). Preset: 5
distinctWords A word found in only one name, spelled right, is enough on its own ("ragnarok"). Preset: on
partialWords A name of 3+ words matches with all but one ("red dead"). Preset: on
precise Spelled right beats a typo of a longer name; ties go to the name covering more of the query. Preset: on
notDistinct Words never distinctive alone. Preset: page, channel, article, piece
notHere Names the site doesn't have ("React Native" next to React): the query matches nothing, with notHere set
ignore, stopWords, similarPattern The owner's name, words too common to count, and what "anything like X?" looks like

portfolioConfig({ legacyMatching: true }) turns the first five off, matching the original site exactly.

Rules beyond the preset

extraRules add to a preset's rules instead of replacing them, and "before": "<rule id>" runs one earlier so it wins the pair. label-prefix with stems: true links editions: "Student rePo (Android)" ↔ "(Web)".

JSON-LD options (toJsonLd(graph, options))

Option Effect
baseUrl Makes urls absolute; ids stay under it, even for items hosted elsewhere
knowsAbout A curated list for the Person, instead of every skill
include Only these entity ids besides the person: one project's page
includeEmail Publish the person's email. Default off
types schema.org type per entity type (projects are SoftwareApplication, creative pieces CreativeWork)
itemList An ItemList of one type's entities, for a listing page: "project", or { type, name, url }
breadcrumb A BreadcrumbList ending at one entity, for its page: an id, or { id, parents: [{ name, url }] }. Default parent: the home page
occupations The person's roles as hasOccupation, alongside worksFor. Default off

Software apps get applicationCategory (from data.applicationCategory; the portfolio preset picks one of Google's app types from the project's topics) and operatingSystem (from data.operatingSystem: the project's platforms), the two properties Google's Software App rich result needs without a price or rating.

What else a site can publish

All built from the same graph, at build time:

Export What it is
toLlmsTxt(graph, { full: true }) llms-full.txt: each item under its own heading, with its full description and how it connects, in sentences
toKnowledge(graph, options) The graph as one JSON file for an AI assistant to read: every entity with a short description and its strongest connections in words, and every link as [from, kind, to, weight] (plus what the two share). Versioned (v: 3); extra adds the site's own sections. Publish it as /pubba-knowledge.json so an assistant and the pages agree
toSitemapEntries(graph, { baseUrl }) A sitemap entry for each page on the site, with lastModified from data.updated or data.date. toSitemapXml(entries) writes the sitemap.xml

The guide: createGuide

The navigator without any UI or personality. What it looks like (a search bar, a chat bubble, a bot, a character) is entirely yours; the guide decides what to say, where to go and when to nudge.

The site's AI: pubba/ai

For questions the guide can't answer from the graph ("is she open to remote work?"), a site can add an AI: Claude, OpenAI, Gemini, or any model behind a small interface. The guide still answers first and the AI is asked only when its reply is none, never for not-here. Every failure (switched off, over a limit, slow, an error, a declined or unusable answer) quietly gives back the guide's own reply, so the guide works the same without it.

The model call runs on the site's server, where the API key is:

Bundles: one brain, any platform

pubba compile pubba.json --out pubba.bundle.json writes the finished graph as one versioned JSON file: entities, links with their final weights, runtime settings and sentence templates. All the rule work happens there, once. loadBundle(json) answers from it exactly as the full build does (checked on the portfolio's live content: 1,251 answers compared, no differences). The portfolio's bundle is 6.4 KB gzipped.

This is how pubba reaches other languages: a small runtime per language loads the same bundle, implements spec/SPEC.md, and must pass the conformance suite (4,698 cases over five sample sites) to count as done. The TypeScript, Python, Kotlin, Swift, Dart and PHP runtimes all pass 100%. C# comes later (docs/multiplatform-design.md).

Python

No dependencies, Python 3.9+, the same answers as TypeScript (the conformance suite, and 880 cases on the portfolio's live content, with no differences). See packages/python.

Kotlin and Java (Android, JVM)

Only the Kotlin standard library, Java 8 bytecode, usable from Java too. A Jetpack Compose sample app with a guide is in examples/android. See packages/kotlin.

Swift (iOS, macOS, every Apple platform)

Xcode: File → Add Package Dependencies… → https://github.com/Tharindu127/pubba.

No dependencies beyond Foundation; Sendable, and clean in Swift 6 mode. A SwiftUI sample app with a guide is in examples/ios. See packages/swift.

Dart and Flutter

Pure Dart with no dependencies, so it runs in Flutter on every target and on the server. A Flutter sample app with a guide is in examples/flutter. See packages/dart.

PHP (WordPress, Laravel, any PHP site)

PHP 8.1+ with only json and mbstring; without Composer, copy packages/php and require its autoload.php. A WordPress plugin (related items under each page, [pubba_next], an Ask guide with nudges) is in packages/php.

HTTP and MCP: pubba serve, pubba mcp

For a platform without a runtime yet, or for AI assistants:

Intent profiles

next treats every visitor alike unless the site says why people come. A recruiter hiring for mobile who opens two iOS apps and a role should be led to the other shipped apps; a web client who opens two web builds, to the web work. Intent profiles describe those reasons in config, and pubba reads the likely one from the trail alone:

The portfolio preset ships three as a worked example (PORTFOLIO_INTENTS: hiring for mobile, a web build, the creative work), off unless presetOptions: { "intents": true }. Every runtime reads intents from the bundle and gives the same answers.

Measurement events

pubba can tell a site how its guide is used, without tracking anyone. It only emits events: no storage, no network calls, no visitor or session ids, no timestamps, and never the text of a question or answer. The site decides where events go.

summarise gives the funnel rows a guide is judged by: did the visitor use the guide, did it lead them to a project, and did they reach contact after it did.

The evaluation harness

Accuracy should stay near 100% as the content grows, so the test set grows with it. Three parts:

A drop below the baseline exits 1, so CI fails.

On real data. Run against the live content of the portfolio it was extracted from (160 entities, 327 links):

Matching Suggestions
Site's original matching (legacyMatching: true), 49 hand-written queries, 16 trails 87.8% 93.8%
The same, with the 243 generated queries and 114 generated trails added 96.2% 98.5%
Preset defaults + an editions rule + notHere: ["React Native"], hand-written + 243 generated queries, 114 generated trails 100% (292/292) 100% (130/130)

Each failure along the way pointed at a fix that is now a matching option (typoMinLength, distinctWords, partialWords, precise, notHere) or a rule option (stems, before), all covered by tests. Generated cases found four matcher weaknesses that the hand-written set never hit: "Swift" landing on SwiftUI, "Saga II" on "Saga", a typo'd whole name losing to a shorter exact one, and "Odoo REST API" losing to a project's first word.

npm run eval runs it on the fictional example (38 hand-written + 83 generated queries, 12 + 35 trails, all passing), and CI runs it with lint on every push.

CLI

Every command except compile also takes a compiled bundle in place of the pubba.json, answering exactly as a runtime would. A pubba.json holds a preset, content and config: examples/portfolio/pubba.json.

The Claude skill

skill/ is a Claude skill that sets pubba up for a site and keeps it healthy:

  1. Maps the site's existing content (JSON, Markdown, a CMS export, a database dump) to entities, types, aliases, link kinds, rules and weights, and shows the mapping for review before writing anything.
  2. Generates schema.org JSON-LD (Person, SoftwareApplication, CreativeWork, with creator, knowsAbout and worksFor, plus lists and breadcrumbs for pages), llms.txt and llms-full.txt, the knowledge file and sitemap entries from the graph, and validates the JSON-LD.
  3. Builds a sample query set from the site's own content, runs the harness, and suggests fixes to aliases, weights or rules.

Copy or link the folder into ~/.claude/skills/pubba (or a project's .claude/skills/).

Behaviour notes

Roadmap

v1 (0.1.x, released): the schema, the graph builder with derived-link rules, related items, what-next from a trail, search, autocomplete and the matcher; machine-readable reasons with overridable sentence templates; the evaluation harness with generated cases and lint; the portfolio preset; JSON-LD and llms.txt helpers; the CLI and the Claude skill. Hardened by switching the portfolio site to it: see CHANGELOG.md.

Every platform (design: docs/multiplatform-design.md). 0.3.0 laid the foundation: bundles, the spec, the conformance suite and the headless guide. 0.4.0 added the Python runtime and pubba serve / pubba mcp; 0.5.0 the Kotlin runtime and an Android sample; 0.6.0 the Swift runtime and an iOS sample; 0.7.0 the Dart runtime and a Flutter sample; 0.8.0 the PHP runtime and a WordPress plugin; 0.9.0 intent profiles in every runtime at once. C# comes later.

1.0.0: stable. The bundle format and every runtime's public API are covered by semantic versioning: see STABILITY.md for what that promises, including when answers may change.

v2: knowing the visitor, measuring, exporting (design: docs/v2-design.md). Measurement events shipped in 0.2.0, intent profiles in 0.9.0 and the remaining exports in 1.1.0.

v3: any AI, and AI assistants as visitors

Development

License

MIT © Tharindu Athapaththu


All versions of pubba with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tharindu127/pubba contains the following files

Loading the files please wait ...