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

@edwinagudelo/php

v1.0.1

Published

PHP render for Express.js

Downloads

5

Readme

php

English Documentation Created by Edwin Agudelo

My e-mail: [email protected]

«php» is a module created in order to render files in PHP format, in order to be able to use a single service to serve both files Node.js, like php. I designed this module for the purpose of learning, it is not very professional and not recommended for use on large projects.

It can be useful for development teams in which there are programmers experienced in php working with programmers with experience in Node.js, allowing each one to develop with their preferred language.

NOTES

  1. ONLY works on linux distributions.
  2. Need php installed natively on the system.

Usage:

#########################################################

  1. Call the dependencies: ### ------------------------------------------------- ### const   path = require('path'),   express = require('express'),   PHP = require('@edwinagudelo/php'); #########################################################
  2. Instantiate: ### ------------------------------------------------- ### const   app = express(),   php = new PHP(); #########################################################
  3. Indicate the folder of our views: }### ------------------------------------------------- ### php.views = path.join(__dirname, 'views'); #########################################################
  4. Define our routes: ### ------------------------------------------------- ### app.get('/', (req, res) => {   php.render('index', function (ans) {     res.write(ans);     res.end();   }); }); app.all('/*', (req, res) => {   testRender(req, res); }); app.get('/test', (req, res) => {   testRender(req, res); }); function testRender(req, res){   php.render(req.url==='/test'?'test':'error', function (ans) {     try {       res.write(ans);       res.end();     } catch (err) {       if (err.code === 'ERR_INVALID_ARG_TYPE') {         let           errorText = [             'File not found.',             'Verify the file route.'           ],           error = `<h1>${errorText[0]}${errorText[1]}<h1>`;         console.log(`${errorText[0]}\n${errorText[1]}`);         res.write(error);         res.end();       };     };   }); }; #########################################################
  5. Start the server: ### ------------------------------------------------- ### app.listen(9811, () =>   console.log('\x1b[1;4;3;36mCreated by Edwin Agudelo -> [email protected]\x1b[0m\nServer active on port', 9811) ); ######################################################### #########################################################

Documentacion en español Creado por Edwin Agudelo

Mi correo: [email protected]

«php» es un modulo creado con la finalidad de renderizar archivos en formato PHP, con la finalidad de poder utilizar un unico servicio para servir tanto archivos Node.js, como php. Este modulo lo diseñe con el proposito de aprender, no es muy profesional y no se recomienda utilizarlo en grandes proyectos.

Puede ser de utilidad para equipos de desarrollo en los cuales hay programadores con experiencia en php trabajando con programadores con experiencia en Node.js, permitiendole a cada uno desarrollar con su lenguaje de preferencia.

NOTAS

  1. SOLO funciona en distribuciones linux.
  2. Debe tener instalado php de manera nativa en el sistema.

Modo de uso:

#########################################################

  1. Llamamos las dependencias: ### ------------------------------------------------- ### const   path = require('path'),   express = require('express'),   PHP = require('@edwinagudelo/php'); #########################################################
  2. Instanciamos: ### ------------------------------------------------- ### const   app = express(),   php = new PHP(); #########################################################
  3. Indicamos la carpeta de nuestras vistas: ### ------------------------------------------------- ### php.views = path.join(__dirname, 'views'); #########################################################
  4. Definimos nuestras rutas: ### ------------------------------------------------- ### app.get('/', (req, res) => {   php.render('index', function (ans) {     res.write(ans);     res.end();   }); }); app.all('/*', (req, res) => {   testRender(req, res); }); app.get('/test', (req, res) => {   testRender(req, res); }); function testRender(req, res){   php.render(req.url==='/test'?'test':'error', function (ans) {     try {       res.write(ans);       res.end();     } catch (err) {       if (err.code === 'ERR_INVALID_ARG_TYPE') {         let           errorText = [             'Archivo no Encontrado.',             'Verifique la ruta de los archivos.'           ],           error = `<h1>${errorText[0]}${errorText[1]}<h1>`;         console.log(`${errorText[0]}\n${errorText[1]}`);         res.write(error);         res.end();       };     };   }); }; #########################################################
  5. Iniciamos el servidor: ### ------------------------------------------------- ### app.listen(9811, () =>   console.log('\x1b[1;4;3;36mCreado por Edwin Agudelo -> [email protected]\x1b[0m\nServidor activo en el puerto', 9811) );