Comments (16)
👍
from atom-beautify.
@m1ga have you tried the PHP-Beautifier on it's own, from PIP? I just want to confirm that it works correctly, on it's own and as expected by yourself (a PHP user), before I go down that path.
from atom-beautify.
@Glavin001 yes I've tried (pear) PHP-Bautifier from the command line and it looks fine. Haven't had the time to look at the options yet but even with the standard settings it looks fine!
The (atom) php-beautifier isn't working because of https://github.com/sdwood/php-beautifier/issues/3
from atom-beautify.
Hah, pear. As you can see, I am not a PHP user myself 😉.
I'll see if I can get it working soon.
from atom-beautify.
Installing pear
for Mac: http://coolestguidesontheplanet.com/installing-pear-osx-10-9-mavericks-osx10-810-7/
from atom-beautify.
@m1ga could you give me a little sample snippet of PHP code, before and after beautification? So I can do some test.
I am trying with:
$t=date("H");
if ($t<"10") {
echo "Have a good morning!";
} elseif ($t<"20") {
echo "Have a good day!";
} else {
echo "Have a good night!";
}
However it does not change after beautifying..
Update: turns out you must have the <?php
and ?>
in the file, as well. Totally forgot. Silly me.
from atom-beautify.
sure
<?php
if (!isset($_SESSION)) session_start();
require_once("sql.req.php");
// friend requests
$q = $mysqli->query("");
$num = $q->num_rows;
echo '<a href="notifications.php">';
if ($num>0) { echo '<i class="fa fa-star white"></i>';
}else { echo '<i class="fa fa-star-o"></i>'; }
echo '</a>';
// new messages
$q = $mysqli->query("");
$num = $q->num_rows;
echo '<a href="messages.php">';
if ($num>0) {
echo '<i class="fa fa-envelope white"></i>';
}else {
echo '<i class="fa fa-envelope-o"></i>';
}
echo '</a>';
?>
from atom-beautify.
Thank you, @m1ga.
On my Mac it is not working cleanly:
$ php_beautifier --indent_spaces test.php test.php.out
PHP Strict Standards: Non-static method Console_Getopt::readPHPArgv() should not be called statically in /Users/glavin/pear/bin/php_beautifier on line 70
PHP Strict Standards: Non-static method Console_Getopt::getopt() should not be called statically in /Users/glavin/pear/bin/php_beautifier on line 84
PHP Strict Standards: Non-static method Console_Getopt::doGetopt() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 92
PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 109
PHP Strict Standards: Non-static method Console_Getopt::_parseLongOption() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 153
PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 154
PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /Users/glavin/pear/bin/php_beautifier on line 85
So instead of using stdout, have php_beautify pipe to file.
Note: Use https://github.com/bruce/node-temp for creating temporary file that will receive output.
from atom-beautify.
I'm getting these warnings too but the test.php.out file looks good.
from atom-beautify.
Done and tested (on Mac).
/cc @karolyi
from atom-beautify.
@m1ga for the time being, until @karolyi has reviewed the Pull Request, you can use my fork:
# Clone fork repo
git clone [email protected]:Glavin001/atom-beautify.git
# Change into repo directory
cd atom-beautify/
# Install dependencies
npm install
# Uninstall old atom-beautify, if applicable
apm uninstall atom-beautify
# Link and use this atom-beautify
apm link
# Update dependencies
npm install
# Restart atom
Let me know if there is anything else.
from atom-beautify.
I can't use php_beautifier cause of temporary file of current active session... I'm on Ubuntu 14.04 with php 5.6 and latest version of atom. All php_beautifier dependencies have installed and they're working correctly from terminal.
Please see giving error:
Command failed: /bin/sh -c [ -f ~/.bash_profile ] && source ~/.bash_profile;[ -f ~/.bashrc ] && source ~/.bashrc;php "/usr/bin/php_beautifier " --input "/tmp/input115014-12433-1i2xoqb" --output "/tmp/115014-12433-1ke9sic" /bin/sh: 1: source: not found
I've watched carefully "/tmp/" directory. But there's no file created during any session... How to solve this?
from atom-beautify.
@Batmandakh I have the same error.
from atom-beautify.
+1 same error with tmp files
from atom-beautify.
Sounds like for some reason source ~/.bashrc;
is not working on your Ubuntu computer.
The afflicting lines of code can be found at: https://github.com/Glavin001/atom-beautify/blob/master/lib/langs/cli-beautify.coffee#L45-L50
If you can comment out those lines in your local installation of Atom Beautify, that should fix it. You will have to manually set the path of php_beautifier
in the Atom Beautify Package Settings.
#164 will solve this.
from atom-beautify.
Whenever I try to use your package to beautify my php file it throws me this.
spawn php ENOENT
spawn php ENOENT
Hide Stack Trace
Error: spawn php ENOENT
at exports._errnoException (util.js:734:11)
at Process.ChildProcess._handle.onexit (child_process.js:1035:32)
at child_process.js:1127:20
at process._tickCallback (node.js:357:13)
Is it because of wrong configuration?
from atom-beautify.
Related Issues (20)
- Javascript space before paren HOT 1
- Failed to activate the atom-beautify package HOT 3
- beautify HOT 1
- download failed HOT 1
- Cannot beautify Velocity file HOT 1
- Installed but not listed on packages tab HOT 1
- dart language not support HOT 1
- Could not find 'uncrustify'. The program may not be installed. HOT 1
- 0 I've been trying to install atom-beautify on my Windows 10 x64 machine, but I keep getting this error : npm ERR! code Z_BUF_ERROR npm ERR! errno -5 npm ERR! zlib: unexpected end of file npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\*****\.atom\.apm\_logs\2019-01-18T06_40_37_988Z-debug.log Googling about it, I found this is an issue that has been raised but closed without much in the way of resolution : https://github.com/Glavin001/atom-beautify/issues/2240 I tried uninstalling and reinstalling Atom, and also deleting the .apm folder and giving it another go, and then trying to install previous versions of atom-beautify using the following, apm install [email protected] apm install [email protected] But nothing seems to work, and I get the same error with a Deprecation warning on the latter. Has anyone else encounteredd this issue, are there any known work-arounds for it? HOT 1
- Atom-beautiful
- atom-beautify
- cant go futher of this HOT 1
- network is unreachable
- it was not installing HOT 1
- PHP beautify problem HOT 1
- How can I solve this problem ? HOT 2
- facing error HOT 2
- Not working :( HOT 1
- i
- Object.<anonymous> is deprecated.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-beautify.