PHP Class converter to namepaces.

Overview

Namespacer

This tool will assist you in taking older underscore/prefix spaced code and will namespace it as best as it can, and also make the files and class names ZF/PEAR compatible.

This two step command will first scan files and produce a map. You can then view or edit the file before moving onto the second step. The second step does the actual transformation. These transformations will be done in place, so it is best to either do this in a separate copy of the code, or on top of a git repository where you can easily reset --hard if you need to.

Download: https://github.com/ralphschindler/Namespacer/blob/master/namespacer.phar?raw=true

  • First, create a map file:

    namespacer.phar map --mapfile types.php --source path/to/src
    
  • Second, transform the types located in the map file:

    namespacer.phar transform --mapfile types.php
    
You might also like...
JavaScript to JQuery Converter

JQuery To Javascript Converter for helping to removing JQuery on websites.

The WordPress Categories to Tags Converter.

=== Categories to Tags Converter === Contributors: wordpressdotorg Donate link: Tags: importer, categories and tags converter Requires at least: 3.0

PHP Router class - A simple Rails inspired PHP router class.

PHP Router class A simple Rails inspired PHP router class. Usage of different HTTP Methods REST / Resourceful routing Reversed routing using named rou

A Formatter Class for Laravel 4 based on FuelPHP's Formatter Class

Changelog Update support for Laravel 6 & phpunit 8 Update composer.json Upgrade to PSR-4 add parameter newline, delimiter, enclosure, and escape to ex

Exploiting and fixing security vulnerabilities of an old version of E-Class. Project implemented as part of the class YS13 Cyber-Security.

Open eClass 2.3 Development of XSS, CSRF, SQLi, RFI attacks/defences of an older,vulnerable version of eclass. Project implemented as part of the clas

A full-scale PHP sandbox class that utilizes PHP-Parser to prevent sandboxed code from running unsafe code
A full-scale PHP sandbox class that utilizes PHP-Parser to prevent sandboxed code from running unsafe code

A full-scale PHP 7.4+ sandbox class that utilizes PHP-Parser to prevent sandboxed code from running unsafe code. It also utilizes FunctionParser to di

Simple utility and class library for generating php classes from a wsdl file.

wsdl2phpgenerator Simple WSDL to PHP classes converter. Takes a WSDL file and outputs class files ready to use. Uses the MIT license. Announcement: We

PHP class to generate bookmarklets from Javascript code

Bookmarklet Gen Convert readable Javascript code into bookmarklet links Features removes comments compresses code by removing extraneous spaces, but n

A full-scale PHP 5.3.2+ sandbox class that utilizes PHPParser to prevent sandboxed code from running unsafe code.
A full-scale PHP 5.3.2+ sandbox class that utilizes PHPParser to prevent sandboxed code from running unsafe code.

##DEPRECATED: The PHPSandbox project has transfered to Corveda/PHPSandbox and will be actively maintained there. This branch is no longer being active

GifCreator is a PHP class that creates animated GIF from multiple images

================================ GifCreator ================================ GifCreator is a PHP class to create animated GIF from multiple images For

GifFrameExtractor is a PHP class that separates all the frames (and their duration) of an animated GIF

================================ GifFrameExtractor ================================ GifFrameExtractor is a PHP class that separates all the frames (an

A Simple Logging Class For PHP

KLogger: Simple Logging for PHP A project written by Kenny Katzgrau and Dan Horrigan. About KLogger is an easy-to-use PSR-3 compliant logging class fo

Optimizes class loading performance by generating a single PHP file containing all of the autoloaded files.
Optimizes class loading performance by generating a single PHP file containing all of the autoloaded files.

Class Preloader for PHP This tool is used to generate a single PHP script containing all of the classes required for a specific use case. Using a sing

PHP routing class. Lightweight yet flexible. Supports REST, dynamic and reversed routing.

AltoRouter AltoRouter is a small but powerful routing class, heavily inspired by klein.php. $router = new AltoRouter(); // map homepage $router-map(

Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

Motto: "Every business should have a detection script to detect mobile readers." About Mobile Detect is a lightweight PHP class for detecting mobile d

A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting.

SqlFormatter A lightweight php class for formatting sql statements. It can automatically indent and add line breaks in addition to syntax highlighting

A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting.

SqlFormatter A lightweight php class for formatting sql statements. It can automatically indent and add line breaks in addition to syntax highlighting

🕷 CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent
🕷 CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent

crawlerdetect.io About CrawlerDetect CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent and http_from header. Current

Image Cache is a very simple PHP class that accepts an image source and will compress and cache the file, move it to a new directory, and returns the new source for the image.

NO LONGER MAINTAINED!!! Image Cache v. 1.0.0 Image Cache is a very simple PHP class that accepts an image source and will compress and cache the file,

Comments
  • Zend\Code\Exception\RuntimeException  No tokens were provided

    Zend\Code\Exception\RuntimeException No tokens were provided

    Tried using this library, but got this error each time.

    $ php namespacer.phar map --mapfile map.php --source .
    ======================================================================
       The application has thrown an exception!
    ======================================================================
     Zend\Code\Exception\RuntimeException
     No tokens were provided
    ----------------------------------------------------------------------
    phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/vendor/zendframework/zend-code/Zend/Code/Scanner/TokenArrayScanner.php:2
    #0 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/vendor/zendframework/zend-code/Zend/Code/Scanner/TokenArrayScanner.php(2): Zend\Code\Scanner\TokenArrayScanner->scan()
    #1 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/src/Namespacer/Model/Mapper.php(2): Zend\Code\Scanner\TokenArrayScanner->getClassNames()
    #2 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/src/Namespacer/Model/Mapper.php(2): Namespacer\Model\Mapper->getMapDataForFile('/Users/JT/Sites...')
    #3 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/src/Namespacer/Controller/Controller.php(2): Namespacer\Model\Mapper->getMapDataForDirectory('.')
    #4 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/vendor/zendframework/zend-mvc/Zend/Mvc/Controller/AbstractActionController.php(2): Namespacer\Controller\Controller->createMapAction()
    #5 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
    #6 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/vendor/zendframework/zend-eventmanager/Zend/EventManager/EventManager.php(2): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
    #7 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/vendor/zendframework/zend-eventmanager/Zend/EventManager/EventManager.php(2): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
    #8 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/vendor/zendframework/zend-mvc/Zend/Mvc/Controller/AbstractController.php(2): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
    #9 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/vendor/zendframework/zend-mvc/Zend/Mvc/DispatchListener.php(2): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Console\Request), Object(Zend\Console\Response))
    #10 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
    #11 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/vendor/zendframework/zend-eventmanager/Zend/EventManager/EventManager.php(2): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
    #12 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/vendor/zendframework/zend-eventmanager/Zend/EventManager/EventManager.php(2): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
    #13 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/vendor/zendframework/zend-mvc/Zend/Mvc/Application.php(2): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
    #14 phar:///Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar/namespacer.php(2): Zend\Mvc\Application->run()
    #15 /Users/JT/Sites/dsgnwrks.pro/wp-content/mu-plugins/cmb2/namespacer.phar(7): require('phar:///Users/J...')
    #16 {main}
    ======================================================================
       Previous Exception(s):
    ======================================================================
    
    opened by jtsternberg 1
Owner
Ralph Schindler
Ralph Schindler
This library provides a way of avoiding usage of constructors when instantiating PHP classes.

Instantiator This library provides a way of avoiding usage of constructors when instantiating PHP classes. Installation The suggested installation met

Doctrine 10.7k Dec 29, 2022
HTML to PDF converter for PHP

Dompdf Dompdf is an HTML to PDF converter At its heart, dompdf is (mostly) a CSS 2.1 compliant HTML layout and rendering engine written in PHP. It is

null 9.3k Jan 1, 2023
Unit converter and calculator for php

Unit converter and calculator This library uses the awesome lisachenko/z-engine to allow mathematical operations on objects, allowing to do stuff like

Dominik Chrástecký 8 Apr 8, 2022
Arbitrary number base converter.

Numbase Easily convert numbers between arbitrary bases and symbol sets. Installation This library is available on Packagist as thunderer/numbase. It r

Tomasz Kowalczyk 23 Sep 25, 2022
An ANSI to HTML5 converter

ANSI to HTML5 Converter This small library only does one thing: converting a text containing ANSI codes to an HTML5 fragment: require_once __DIR__.'/v

SensioLabs 216 Dec 9, 2022
Laravel: Data to Monthly Converter

Laravel: Data to Monthly Converter Using this package you will be able to converts your collection using a timestamp field to order data monthly or ye

101INFOTECH 9 Nov 23, 2022
UUID <=> ULID bidirectional converter

uuid-ulid-converter UUID <=> ULID bidirectional converter Installing composer require mpyw/uuid-ulid-converter API static string Converter::uuidToUli

mpyw 4 Mar 27, 2022
Google-like values converter

Google-like values converter. Support for different types of conversions, for examples: 1 kilometer -> meters 1 dollar -> THB 1 kilogram -> meters ...

Pavinthan 1 Nov 4, 2021
PHPUnit to Pest Converter

PestConverter PestConverter is a PHP library for converting PHPUnit tests to Pest tests. Before use Before using this converter, make sure your files

null 10 Nov 21, 2022
A full-featured home hosted Cloud Drive, Personal Assistant, App Launcher, File Converter, Streamer, Share Tool & More!

A Fully Featured home-hosted Cloud Storage platform and Personal Assistant that Converts files, OCR's images & documents, Creates archives, Scans for viruses, Protects your server, Keeps itself up-to-date, and Runs your own AppLauncher!

Justin Grimes 178 Dec 26, 2022