|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "A word on the focus of php.js" |
| 4 | +date: 2013-05-03 13:18 |
| 5 | +comments: true |
| 6 | +categories: [ focus ] |
| 7 | +--- |
| 8 | + |
| 9 | +Hi everybody, |
| 10 | + |
| 11 | +The [new site](/blog/2012/09/26/new-site/) has no server-side code. Instead |
| 12 | +we generate HTML [using Octopress](http://kvz.io/blog/2012/09/25/blog-with-octopress/) |
| 13 | +and push to GitHub Pages, all from one [repository](https://github.com/kvz/phpjs). |
| 14 | + |
| 15 | +This saves hosting costs/overhead and makes it really easy for people to submit |
| 16 | +pull requests and for [contributors](https://github.com/kvz/phpjs/contributors) |
| 17 | +to make changes that I don't always have time |
| 18 | +for. It makes the project less dependent on me and more a community effort. |
| 19 | + |
| 20 | +To move forward, sometimes you have to cut features. |
| 21 | +In this case I had to lose our compiler, a webtool that relied on server-side code |
| 22 | +to generate minified packages from php.js functions. |
| 23 | + |
| 24 | +Understandibly this has [raised](https://github.com/kvz/phpjs/issues/75) |
| 25 | +[questions](http://phpjs.org/about/index.html#comment-861825612). |
| 26 | +It still only takes 2 commands to bundle 4 useful functions: |
| 27 | + |
| 28 | +```bash |
| 29 | +# - Note that this combined 6 useful php.js functions into a file called: myphp.js |
| 30 | +# and minified version: myphp.min.js in the current directory. |
| 31 | +# - Note that this creates a Javascript include that throws all functions in the |
| 32 | +# global scope. It's better to put them in a dedicated phpjs object. |
| 33 | +PHPJS_VERSION="master" |
| 34 | +curl -sk https://raw.github.com/kvz/phpjs/${PHPJS_VERSION}/functions/{datetime/date\ |
| 35 | + ,datetime/strtotime\ |
| 36 | + ,strings/md5\ |
| 37 | + ,strings/vsprintf\ |
| 38 | +}.js |tee ./myphp.js && \ |
| 39 | +curl -vo ./myphp.min.js \ |
| 40 | + -X POST \ |
| 41 | + -H 'Expect: ' \ |
| 42 | + --data-urlencode compilation_level="SIMPLE_OPTIMIZATIONS" \ |
| 43 | + --data-urlencode output_format="text" \ |
| 44 | + --data-urlencode output_info="compiled_code" \ |
| 45 | + --data-urlencode js_code@myphp.js \ |
| 46 | + http://closure-compiler.appspot.com/compile |
| 47 | +``` |
| 48 | + |
| 49 | +but some people are upset that it has become harder to bundle all of php.js into one big file: |
| 50 | + |
| 51 | +> Not providing an all-in-one, downloadable, minified, ready-to-use |
| 52 | +> .js file is going to kill php.js. |
| 53 | +> You've abandoned windows users, and really any non-CLI junkie. |
| 54 | +> While I am capable of compiling this myself, what a headache. |
| 55 | +> You've introduced a barrier-to-entry that didn't exist before, |
| 56 | +> and by not existing, allowed for the following you now have. |
| 57 | +> I *highly* suggest that you have this available for download, |
| 58 | +> either here or on github, such that you can keep (and maintain) |
| 59 | +> the momentum you worked so hard for. |
| 60 | +
|
| 61 | +I'd like to comment on that here. While I appreciate the sentiment, wether the |
| 62 | +project is being killed by these changes depends on how you look at php.js. |
| 63 | +To me, it's a resource: |
| 64 | + |
| 65 | + - For PHP developers that want see how it's done in JavaScript |
| 66 | + - That enables fun experiments |
| 67 | + - With a few higher level functions that are incredibly useful, and missing in JavaScript |
| 68 | + |
| 69 | +This is what I feel php.js should focus on. Making functions. Making them better. |
| 70 | + |
| 71 | +If - on the other hand - you think of php.js as a |
| 72 | + |
| 73 | + - 2.1MB, 451-function, ready-to-rock spaceship that you can plug into your website so you can keep typing PHP client-side, not caring about learning JavaScript or how that extra weight might impact the user experience |
| 74 | + |
| 75 | +..then yes, *these changes are going to kill php.js*. |
| 76 | + |
| 77 | +I have limited time to spend on open source, and I want to spend it on things I enjoy and can believe in. |
| 78 | +Not on supporting use-cases that keep people from learning or make the web slower. |
| 79 | +I'm sorry if this upsets folks but it really is my free time. |
| 80 | + |
| 81 | +Luckily though for people with different views, I released php.js under MIT so |
| 82 | +it's cool for anybody to fork this project and run with it. |
| 83 | + |
| 84 | +If anything, knowing that the php.js repository will focus on the raw `./functions` |
| 85 | +makes this easier. |
0 commit comments