• Stars
    star
    101
  • Rank 337,140 (Top 7 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Convert paths relative from 1 file to another

Path converter

Build status Code coverage Latest version Downloads total License

Usage

use MatthiasMullie\PathConverter\Converter;

$from = '/css/imports/icons.css';
$to = '/css/minified.css';

$converter = new Converter($from, $to);
$result = $converter->convert('../../images/icon.jpg');
// $result is now '../images/icon.jpg'

Methods

__construct($from, $to)

The object constructor accepts 2 paths: the source path your file(s) is/are currently relative to, and the target path to convert to.

convert($path): string

$path is the relative file, which is currently relative to $from (in constructor). The return value will be the relative path of this same file, but now relative to $to (in constructor)

Installation

Simply add a dependency on matthiasmullie/path-converter to your composer.json file if you use Composer to manage the dependencies of your project:

composer require matthiasmullie/path-converter

Although it's recommended to use Composer, you can actually include these files anyway you want.

License

PathConverter is MIT licensed.

More Repositories

1

minify

CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.
PHP
1,944
star
2

scrapbook

PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APC(u), SQL and additional capabilities (e.g. transactions, stampede protection) built on top.
PHP
307
star
3

geo

Helper for geographic searches & clustering of coordinates
PHP
58
star
4

post-to-email

Supporting contact forms for static websites
PHP
15
star
5

php-analyzer

Generates & submits the metrics for cauditor.org
PHP
6
star
6

jquery-autoexpand

Auto-expands textareas so they grow as you type
JavaScript
5
star
7

ogone

Wrapper class to make Ogone implementations a lot easier.
PHP
4
star
8

jquery-simple-slideshow

A simple, low-config, jQuery-based slideshow.
JavaScript
4
star
9

router-old

Extract information from a URL and build urls from controller/action/slugs.
PHP
3
star
10

ci-sniffer

Extract build & environment details from just about any CI server
PHP
3
star
11

php-api-example

Example of a PHP API with matthiasmullie/php-api
PHP
2
star
12

php-api

A neat little framework for creating PHP APIs
PHP
2
star
13

hotelguide

Discontinued! Source code for http://www.last-minute-vakanties.be & app
PHP
1
star
14

local-wmf-setup

This is a stab at using the WMF config locally, by hacking around some stuff the cluster setup assumes to be there (but may not be in a local setup).
PHP
1
star
15

curator.io

PHP
1
star
16

types

PHP
1
star
17

periodic-rclone-sync

A dead simple container to automatically sync one directory to another on any given interval
Makefile
1
star