Download the PHP package mrpunyapal/git-reader without Composer

On this page you can find all versions of the php package mrpunyapal/git-reader. 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 git-reader

Git Reader

Tests Latest Version on Packagist Total Downloads PHP Version PHP Version Compatibility

Git Reader is a read only Git client for PHP. It connects to a Git server over HTTPS, resolves a branch or tag to a commit, downloads a shallow snapshot of that commit, and lets you read files from it.

It does not run the git binary. It does not clone a working copy. It does not call provider APIs. Any server that speaks the standard Git smart HTTP protocol works: GitHub, GitLab, Bitbucket, Gitea, or your own installation.

Installation

Requires PHP 8.3 or newer with the zlib extension. There are no other dependencies.

Usage

How it works

The library speaks the same protocol that git clone uses over HTTP:

  1. A GET request returns the list of refs from the server.
  2. A single POST asks for one commit with depth 1.
  3. The server replies with a packfile. The parser inflates each object, resolves deltas, and stores them in a temporary directory.
  4. Tree objects are walked to find files, and blob contents are read on demand.

Because this is the standard protocol, the library works with any host and never needs to know which one it is talking to.

API

Call Purpose
new RemoteRepository(string $url) Create a client for a Git HTTPS URL
$repo->refs(): RefAdvertisement List refs on the server
$repo->resolveRef(string $ref): ResolvedRef Turn a branch, tag, or SHA into a commit SHA
$repo->fetchTipSnapshot(string $sha): PackObjectStore Download a depth 1 snapshot
$store->commitTreeSha(string $sha): string Get the root tree of a commit
$store->resolveTreePath(string $tree, string $path): TreeEntry Walk to a subdirectory or file
$store->flattenTree(string $tree): array List every path below a tree
$store->object(string $sha): GitObject Read an object by SHA
$store->cleanup(): void Delete the temporary store

Limits

Used by

Testing

The test suite runs offline. Recorded responses from real git servers are replayed by PHP's built in web server, so the full request cycle is covered without network access.

License

MIT


All versions of git-reader with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-zlib 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 mrpunyapal/git-reader contains the following files

Loading the files please wait ...