Download the PHP package jeffersongoncalves/laravel-zero-git without Composer
On this page you can find all versions of the php package jeffersongoncalves/laravel-zero-git. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jeffersongoncalves/laravel-zero-git
More information about jeffersongoncalves/laravel-zero-git
Files in jeffersongoncalves/laravel-zero-git
Package laravel-zero-git
Short Description Detect the current repository from the git remote: parse SSH/HTTPS remote URLs into host/owner/repo and build a stable slug, used by CLIs that auto-detect their workspace/repo.
License MIT
Homepage https://github.com/jeffersongoncalves/laravel-zero-git
Informations about the package laravel-zero-git
laravel-zero-git
Detect the current repository from its git remote. This package parses SSH and
HTTPS remote URLs into host / owner / repo, builds a stable slug, and can
read the remote of a working directory directly from git.
It is used by Laravel Zero CLIs (such as Bitbucket / Jira tools) that auto-detect their workspace and repository from the local git checkout.
Why
CLIs that operate on "the current repo" need a reliable way to turn a git
remote URL into structured data, regardless of whether the remote is an SSH or
HTTPS URL, with or without a .git suffix, with or without embedded
credentials or a port. This package centralizes that parsing in one tested,
framework-free place.
Installation
Requires PHP ^8.2. No other dependencies.
Usage
Parse a remote URL
Supported shapes:
git@host:owner/repo.git(SSH scp-like)ssh://git@host:port/owner/repo.githttps://host/owner/repo(with or without.git, with or withoutuser@)
Build a stable slug
The slug is a lowercased, sanitized owner-repo string, suitable as a stable
key for per-repository config files.
Resolve from the current checkout
resolve() and currentRemoteUrl() return null when the directory is not a
git repository or the remote does not exist / cannot be parsed.
Public classes
| Class | Purpose |
|---|---|
JeffersonGoncalves\LaravelZero\Git\RemoteInfo |
Readonly DTO: host, owner, repo, fullName() |
JeffersonGoncalves\LaravelZero\Git\GitRemoteParser |
parse(string): ?RemoteInfo, slug(string): ?string |
JeffersonGoncalves\LaravelZero\Git\RepositoryResolver |
resolve(?string): ?RemoteInfo, currentRemoteUrl(?string): ?string |
License
MIT. See LICENSE.