radj
radj

Reputation: 4377

Is it possible to parse and apply patch files in PHP?

The idea is to have a PHP script parse a given .patch file and will apply the given patch accordingly. Assume that the script has no access to command line so the script will have to do the parsing itself. Is there a library somewhere?

Upvotes: 1

Views: 1516

Answers (2)

Danny Kopping
Danny Kopping

Reputation: 5190

Check out https://github.com/ptlis/diff-parser

This is a really solid lib, does exactly what it says on the tin

Upvotes: 1

Marc B
Marc B

Reputation: 360712

There's the PECL xdiff library which can generate diffs from and apply them to data in regular PHP variables.

Upvotes: 3

Related Questions