npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

not-php

v0.3.15

Published

php2coffee + php style helpers for node

Downloads

21

Readme

this is your php on node (not-php)

Port PHP to Coffee-Script

Extracted from my [Exspresso] (https://github.com/darkoverlordofdata/exspresso) project

Installation

$ npm install not-php

You also need to have php installed. Php2coffee is written in php to leverage the Zend lexer.

Quick Start

This will create the output file 'CodeIgniter.php.coffee'

$ php2coffee CodeIgniter.php

Next Steps

Tweak the resulting code. Not-php helper functions are declared globaly, and so will act as a drop in replacement for many php api functions. You will have to update arguments for node style async calls, where appropriate.

Example:

$profile = @where('forgotten_password_code', $code).users().row()# pass the code to profile

Becomes:

@where('forgotten_password_code', $code).users ($err, $users) =>

  if $err then return $next $err
  $profile = $users.row()# pass the code to profile

Known Issues

preg_match

Node does not fully support arguments by reference.

Example:

if preg_match($pattern, $subject, $matches) ...

Correction:

$matches = preg_match($pattern, $subject)
if $matches? ...

arrays

Some nested literal object constructs are mis-tranlsated, and will need to be manually corrected.

Example:

@data['identity'] = 'name':'identity',
  'id':'identity',
  'type':'text',
  'value':@form_validation.set_value('identity',
)

Correction:

@data['identity'] =
  'name':'identity',
  'id':'identity',
  'type':'text',
  'value':@form_validation.set_value('identity')

.eco templates

Eco syntax require a this (@) operator for helpers and variables

Example:

  <td><%- anchor("auth/edit_user/" + $user.id, 'Edit') %></td>

Correction:

  <td><%- @anchor("auth/edit_user/" + @user.id, 'Edit') %></td>

Note that the open coffee tag defaults to <%-, which matches the php default behaviour. Change to <%= as appropriate to escape output.

To Do

  • Complete the test suite
  • Complete Eco templates - address the this (@) operator issue.
    • prepend all external variables
    • prepend all external functions not in the compatability layer.

Options

Usage: php2coffee [OPTIONS] PATH [DESTINATION]

-h, --help          display this help
-j, --javascript    compiles resulting .coffee file
-m, --markup        compiles into .eco markup template
-r, --recursive     recurse source path
-t, --trace         trace output
-T, --tabs          use tab character in output (default is spaces)
-d, --dump          dump of tokens

License

(The MIT License)

Copyright (c) 2012 Bruce Davidson <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.