Download the PHP package leapt/git-wrapper without Composer

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

Leapt Git Wrapper

Package version Build Status PHP Version Code coverage

Allows to manage a Git repository with PHP. Provides an object-oriented wrapper to run any Git command.

Requirements

Instantiate a Repository

It does NOT create a Git repo, but a PHP object to manipulate an existing Git repo.

Create a Git repository

If the Git repository does not exist yet on file system, Repository can create it for you.

It runs git init and returns a Repository object.

Run git commands

git commands can be run with the same syntax as in the CLI. Some examples:

There are no limitations, you can run any git commands.

The git() method returns the output string:

The git() method throws a GitRuntimeException if the command is invalid:

Get branches information

Some shortcut methods are provided to deal with branches in a convenient way.

Get the branches list

Get the current branch

Know if the repo has a given branch

Get tags information

Get the tags list:

Get commits information

You can get an array of the last commits on the current branch.

Internally, this method runs git log with formatted output. The return value should look like:

The first commit is the most recent one.

You can also retrieve the last commit by calling $repository->getLastCommit().

Debug mode

Repository constructor's second parameter lets you enable debug mode. When debug mode is on, commands and their output are displayed.

Configure

Repository can be configured by passing an array of options to the constructor's third parameter.

Change git executable path

You may need to provide the path to the git executable.

On most Unix system, it's /usr/bin/git. On Windows, it may be C:\Program Files\Git\bin.

Change the command class

By default, the Repository class will use the Command class to implement Git commands. By replacing this option, you can use your own command implementation (which must implement the Leapt\GitWrapper\CommandInterface):

Contributing

Feel free to contribute, like sending pull requests to add features/tests or creating issues :)

Note there are a few helpers to maintain code quality, that you can run using these commands:

PHPStan

PHP CS Fixer

PHPUnit

Note: tests rely on the default branch being main. This can be updated using the following command:

History

This package is a maintained fork of the ornicar/php-git-repo package.


All versions of git-wrapper with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
symfony/process Version ^6.4 || ^7.0
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 leapt/git-wrapper contains the following files

Loading the files please wait ....