Download the PHP package survos/loc-bundle without Composer

On this page you can find all versions of the php package survos/loc-bundle. 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 loc-bundle

survos/loc-bundle

Symfony bundle client for the Library of Congress JSON API (loc.gov) — search, collection, and item lookup, with raw responses always preserved alongside tolerant DTOs.

No API key is required for read access. LOC exposes JSON on ordinary loc.gov pages by adding fo=json to the query string; this bundle handles that automatically.

This is a Phase 1 implementation (see survos/mono#23): the API client, DI wiring, and basic console commands. Deliberately not included yet, per the issue's own phasing:

Item::$resources and Item::$raw already carry everything a resource walker would need — adding one is additive, not a breaking change to this phase.

Fetch strategy (cache/retry)

Caching: LocClient's $httpClient is survos_loc.caching_client — a Symfony RFC 9111 CachingHttpClient (fetch-bundle's CachingHttpClientFactory, cache_enabled: true by default) wrapping the scoped loc.client. LOC sends real Cache-Control/ETag headers (24h on item/collection JSON, up to 1 year on tile.loc.gov static files), so this obeys the origin's own freshness window — capped at cache_max_ttl (default 86400s) even if LOC sends a longer max-age — rather than PersistentFetcher's app-controlled "cache forever until forgotten" model. That's the more correct choice here, not a lesser one: LOC already tells us exactly how long each response is good for.

Retry: the loc.client scoped client (see prependExtension) retries transport errors and HTTP 500/502/503/504 (Symfony's built-in retry_failed, exponential backoff). 429 is deliberately excluded — it's surfaced as RateLimitException carrying the real Retry-After value precisely so a caller (a future Phase 4 Messenger consumer) can reschedule itself with the server-specified delay; auto-retrying it here would silently swallow that signal.

Still genuinely missing (this bundle's own Phase 3, survos/mono#23):

RateLimitException/LocApiException/InvalidJsonException remain part of this bundle's tested public API (tests/Client/LocClientTest.php) and are unaffected by any of the above.

Installation

Configuration

All three keys are optional; the defaults above (with a generic Survos LocBundle/0.1 user agent) work out of the box.

Usage

Every DTO (SearchResult, Item, SearchPage, CollectionPage, Pagination) keeps its source array on ->raw — unknown/future LOC fields never cause a hydration failure.

Console commands

Test collections

Useful real collections for manual testing (see the issue for why each is interesting):

Downloading vs. reuse

Successfully fetching or downloading an asset through this bundle says nothing about whether it is legally reusable. Rights fields on LOC responses (item.rights, item.rights_advisory, etc.) are preserved unchanged on Item::$raw — nothing in this bundle collapses them into a boolean.


All versions of loc-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
survos/fetch-bundle Version ^2.5
survos/kit-bundle Version ^2.5
symfony/cache Version ^8.1
symfony/config Version ^8.1
symfony/console Version ^8.1
symfony/dependency-injection Version ^8.1
symfony/http-client Version ^8.1
symfony/http-kernel Version ^8.1
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 survos/loc-bundle contains the following files

Loading the files please wait ...