Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Hardf Laravel Package

pietercolpaert/hardf

A PHP RDF library for parsing and serializing Turtle, TriG, N-Triples, and N-Quads. HARDF offers a lightweight API for reading and writing RDF triples and quads, useful for linked data and semantic web projects.

Deep Wiki
Context7

hardf ("HAndling RDF") is a lightweight PHP library for reading, writing, and converting RDF data. It provides streaming parsers and serializers for Turtle, N-Triples, JSON-LD, and the compact HDT binary format, making it practical to process large datasets without loading everything into memory.

  • Stream-parse Turtle, N-Triples, and HDT
  • Serialize triples to Turtle, N-Triples, and JSON-LD
  • Convert between text and binary RDF formats
  • Callback-based API keeps memory usage low
  • Simple Composer installation with minimal dependencies
Frequently asked questions about Hardf
What is hardf and what RDF formats does it support?
hardf (pietercolpaert/hardf) is a dependency-free, low-level PHP library for parsing and serializing RDF 1.2. It is a codec rather than a framework package: it gives you parsers and serializers plus a lightweight API for quads, triples and terms. Which concrete serializations (Turtle, TriG, N-Triples, N-Quads) and which RDF 1.2 features are fully covered should be verified against the README and a conformance suite before you commit.
How do I install hardf in a Laravel project?
Run composer require pietercolpaert/hardf. It autoloads via PSR-4, is MIT licensed, and requires no native extensions or system binaries, so your Docker and CI images stay unchanged. There is nothing to register, since no service provider, config file or facade is published.
Is hardf a Laravel package with a service provider or facade?
No. hardf is framework-agnostic and has no opinion about your application structure. The recommended approach is to bind your own interface, such as RdfParser or RdfSerializer, to a Hardf-backed implementation inside a Laravel service provider. Keep hardf value objects out of controllers, job signatures and Eloquent models.
Which PHP versions does hardf support?
The package declares a PHP version floor, but the exact supported range and the versions actually exercised in CI should be checked in composer.json and the repository before adopting it. Always confirm the library is tested on the same PHP version you run in production, since a specification-tracking package can lag behind newer releases.
Where should hardf live inside a Laravel codebase?
Put it in a domain or service namespace such as app/Domain/Rdf/ or app/Services/LinkedData/, behind an anti-corruption layer. Consume it from queued jobs and Artisan commands for bulk ingest, export and validation rather than from request-cycle controller code. Convert hardf terms and quads into your own DTOs immediately, then map those to your persistence target.
Does hardf stream large RDF files or load the whole graph into memory?
Streaming, iterator-style parsing is the right shape for ingestion, but you must confirm whether hardf's API actually streams or materializes the full graph before trusting it with large payloads. Benchmark memory on a representative input, such as a 1M-triple file, against your queue worker memory limits. Set explicit size and time limits at the job boundary either way.
Is hardf safe to use in production given its low adoption and single maintainer?
Treat it as a supply-chain and abandonment risk rather than a code-quality one: it has roughly 38 stars, effectively one maintainer and no visible commercial backing. RDF 1.2 is still stabilizing, so a specification-tracking library will have a moving API and minor-version behavior changes in exactly the edge cases you care about. Mitigate by pinning an exact version and isolating it behind your own interface so a swap becomes a one-class change, and assume no SLA or CVE-response guarantee.
How does hardf handle invalid or unsupported RDF input?
The library is low-level by design, so error handling, term normalization and base-IRI resolution expectations are yours to define. Whether it throws exceptions, returns partial results or truncates silently is something you should test explicitly against your own fixtures. Aim to distinguish invalid input from unsupported RDF 1.2 features inside your adapter so failures are diagnosable.
Is it safe to parse untrusted RDF with hardf?
Parsing untrusted RDF is a denial-of-service vector regardless of library: deeply nested structures, oversized literals and pathological IRIs can exhaust memory or CPU. The good news is that hardf does not dereference IRIs, which removes the worst class of risk. You still need payload size caps, timeouts and queue-level isolation around any parse of third-party data.
What are the alternatives to hardf for working with RDF in PHP?
easyrdf/easyrdf and sweetrdf are the usual candidates, and semsol/arc2 is older but still found in legacy code. If one of them covers most of your needs with better support and a stable release line, it may be the lower-risk choice. A sensible path is to define your own parser interface first, then evaluate hardf and its alternatives behind it using a golden corpus of fixtures.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect