Post Project
  • Search
    • Buyers can
    • Search offers to buy now
    • Search freelancers to request a proposal
    • Freelancers can
    • Search projects to quote on
  • How it works
  • Log in
  • Sign up
  • Freelancer?
Browse by Category
    Technology & ProgrammingWriting & TranslationDesignDigital MarketingVideo, Photo & ImageBusinessMusic & AudioMarketing, Branding & SalesSocial Media

    Create a simple, but beautifully written, PHP Command Line Interface (CLI) Program

    - or -

    Post a project like this
    2237
    $
    • Posted: 6 years ago
    • Proposals: 7
    • Remote
    • #1631813
    • Awarded
    Andrew C.
    Andrew C.
    Software Engineering Consultant
    United Kingdom Cwmbran
    Amaneet B.
    Amaneet B.
    PPH #1 Service Provider in Development & IT : Wordpress|Magento|React Native|Mobile App Development|Angular|Node.js
    Top Freelancer with earnings over £500kTop Seller with earnings over £200kTop Endorsed
    India Mohali
    Abhijit A.
    Abhijit A.
    Magento, Drupal and Wordpress Specialist
    Top Seller with earnings over £100kTop Endorsed
    India Kolkata
    Mukesh Y.
    Mukesh Y.
    AI & Data Science Engineer | Nodejs | Ruby On Rails | AWS | GCP | Python | React | Angular |
    Top Endorsed
    New Zealand Auckland
    Zeynep Y.
    Zeynep Y.
    Web designing Web development Android app
    United Kingdom City of London
    Sasikala P.
    Sasikala P.
    Senior Moodle/PHP Expert with 10 Years of Experience
    India Cochin
    Satish K.
    Satish K.
    Web Developer
    India Chandigarh
    3275591283424731741088681132207814632071677412
    Andrew C.
    Amaneet B.Abhijit A.Mukesh Y.Zeynep Y. + 2 others have already sent a proposal.
    • 2
    • 2

    Description

    Experience Level: Entry
    Estimated project duration: less than 1 week
    General information for the business: We create lots of XML files that need to be managed.
    Kind of development: New program from scratch
    Description of every module: A CLI PHP program that can run on Mac, PC or Linux. I am a PHP coder who does not have time to build all the tools I need. If you build the basic framework of the program, I can then refactor the script to add my specific domain knowledge.
    Description of requirements/functionality: Let's exercise your PHP CLI programming skills.

    I hope you might be able to create a program that performs a relatively simple function but which handles errors well and is well tested:

    # XmlFileScanner

    As a writer of XML files, I would like to be able to use a CLI PHP program to scan a given directory (targetDirectory) on PC or Mac and, for each file found with the `.xml` filename extension, set the following details into a variable; full path to file, relative path from the targetDirectory given, filename and filesize. Then, set those details as items in a variable which can be iterated by later code.

    In addition to the arguments passed to the CLI program. The program should also read from an `ignored.txt` file which will reside in the same directory as the PHP script that was run. That file will contain a list of directory names (one per line) that should be ignored when the script is run when the 'recursive' option is TRUE.

    # Input

    The arguments passed to the CLI PHP program are:
    1. `targetDirectory` (Mandatory). The path to the directory which should be scanned
    2. `-r` (Optional). By default the script will just scan the files in the `targetDirectory`, if `-r` is passed as an argument, then sub-directories of the `targetDirectory` will also be scanned recursively.

    The CLI Program should report errors to the Standard Error Stream:

    * Fatal Error: Missing arguments. (If the `targetDirectory` is not provided)
    * Fatal Error: Unknown directory(If the `targetDirectory` cannot be found)
    * Fatal Error: Missing `ignored.txt` not found. (If the file containing directories to ignore is not found)
    * Other errors that you think might be helpful.

    # Output

    Write output to Standard Output Stream.

    * The total number of files found.
    * The total number of Xml files found.
    * The paths of directories that were skipped because they were in the list of ignored directories.
    * The relative paths of Xml files found.

    # Technologies

    * Ideally you will use Object Oriented Programming where needed.
    * Ideally you will make use of classes in the Standard PHP Library (SPL) (http://php.net/manual/en/book.spl.php) where possible.
    * Ideally you will use Test Driven Development and provide PHPUnit Tests along with the code.
    * Ideally you will provide some basic usage instructions along with the application.

    I would be interested to hear your thoughts on how much this would cost me.
    Specific technologies required: PHP OOP
    OS requirements: Windows, Mac OS, Linux

    Extra notes:

    ## Update: The following points have been added in response to discussions with Sellers ##

    * The key point is that I am looking for a CLI application rather than a web application.

    * Experience: You will have had previous experience in building CLI Applications in OOP PHP.

    * If the code is written in OOP and it is written and structured well (i.e using patterns from Domain Driven Design, PofEAA, Gang of Four) then I find it easier to maintain.

    * You could think of this task as a CLI Project Set-up (including Unit Tests) with slightly more than a 'Hello World' functionality. So, I understand that will add to the price. However, coders who have written a few OOP CLI PHP applications may well be able to base this on previously written OOP CLIP PHP applications which would reduce their costs.

    * With regards to the version of PHP.

    The PHP version must be no greater than PHP 7.* and no greater than PHP's current Current Stable release.

    It would be easier for me if it was backward compatible with PHP 5.6 (or whichever PHP version comes pre-installed on Mac Sierra 10.12.5). But, that would be a bonus.

    The 'model' aspect of the code could be re-used in a Drupal 8 custom module to be developed within 6 months. Drupal 8 requires PHP 5.6 ≤ ≥ 7 (https://www.drupal.org/docs/7/system-requirements/php#php_required)

    Given those parameters, I would appreciate if it was 'backward compatible' as possible whilst making the best use of PHP's SPL (some very useful classes have been added since PHP 5.6).

    So, in summary, it could be written in anything between: PHP 5.6 ≤ ≥ PHP 7.* (stable release)
    John W.
    John W.
    100% (3)
    Projects Completed
    3
    Freelancers worked with
    2
    Projects awarded
    43%
    Last project
    12 Mar 2020
    United Kingdom

    New Proposal

    Login to your account and send a proposal now to get this project.

    Log in

    Clarification Board Ask a Question

    • 06 Jul 2017Sasikala P.

      Thanks for the quick reply. I was thinking about the error reporting. In Linux the apache error is reported to error_log file and its different for mac and windows. Is anything i'm missing in this case?

      John W.06 Jul 2017

      Hi Sasikala,

      I think the key point is that I am looking for a CLI application rather than a web application. So, there is no Apache involved.

      See: https://stackoverflow.com/questions/9315714/what-is-difference-between-php-cli-and-php-cgi

      and

      http://php.net/manual/en/features.commandline.introduction.php

      Some examples of CLI applications that have been written in PHP include:

      Composer: https://getcomposer.org/download/
      Drush: http://www.drush.org/

    • 06 Jul 2017Sasikala P.

      In the php script we need to redirect the error to the standard error output, So for windows, linux and mac we need to configure is as differently, right?

      John W.06 Jul 2017

      Hi,

      PHP executable is installed on each platform and does the parsing of the script. So, as long as the code is written in a platform independent way, then it should not need to be configured separately for each environment.

      See: http://alvinalexander.com/php/php-write-stderr-php-command-line-script-fwrite

      and see: https://stackoverflow.com/questions/6654157/how-to-get-a-platform-independent-directory-separator-in-php

      Sasikala P.06 Jul 2017

      Yeah, I agree with that. it should write in to the device mapped as standard error. if its console then it will display the output there. Now its clear. I think I can do it now :)

    454542454470
    2237
    $

    - or -

    Post a project like this
    John W.
    John W.
    100% (3)
    Projects Completed
    3
    Freelancers worked with
    2
    Projects awarded
    43%
    Last project
    12 Mar 2020
    United Kingdom

    Related project Searches


    drupal (cms) linux customization Extensible Markup Language (XML) framework macintosh microsoft windows object oriented programming (oop) PHP programming language phpunit refactoring test driven development (TDD) unit testing user interface (UI) web application

    Product

    • About
    • Team
    • Careers

    Support

    • How it works
    • Trust & Safety
    • Help Centre

    Discover

    • GuidesStoriesNews

    Resources

    • Customer Stories
    • Business Cost Calculator
    • Startup Cities

    Browse

    • Freelance Services
    • Freelance Services By Country
    • Freelance Skills
    • Terms
    • Privacy
    • Sitemap
    • Company Details
    • © 2023 People Per Hour Ltd
    We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
    Cookie Settings
    Accept All Cookies