Download the PHP package ptlis/diff-parser without Composer

On this page you can find all versions of the php package ptlis/diff-parser. 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 diff-parser

ptlis/diff-parser

A parser for unified diff files, returning a hydrated object graph.

Uses __toString() to serialize back into unified diff format.

CircleCI codecov Latest Stable Version

Install

Install with composer:

Usage

Parsing a diff file

Create a parser:

And then get a changeset from a file path:

or parse the patch data stored from a variable:

Serialization

All the value classes implement the method to support direct serialization of that component back to unified diff format.

For example this serializes the data in $changeset into the file my.patch.

The Object Graph

The tree built to store changesets is very simple, mapping one-to-one to the components of a diff file. In essence:

Changeset

From a Changeset you may iterate over the array of files that have changed:

File

Get the original and new filenames:

Get the operation that was performed (create, delete or change):

From a file you may iterate over the change hunks:

Hunk

Get the start line number of the hunk:

Get the number of lines affected in the hunk:

From a hunk you may iterate over the changed lines:

Line

Get the original and new line numbers:

Get the operation:

Get the value of the line:

Contributing

You can contribute by submitting an Issue to the issue tracker, improving the documentation or submitting a pull request. For pull requests i'd prefer that the code style and test coverage is maintained, but I am happy to work through any minor issues that may arise so that the request can be merged.


All versions of diff-parser with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.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 ptlis/diff-parser contains the following files

Loading the files please wait ....