|
Indeed it seems PHP is the new COBOL. In that it's a language that the ancients used and is largely forgotten except for a daring few who will take on maintenance. COBOL programmers make serious bank these days.
|
# ? Jul 27, 2017 03:37 |
|
|
# ? May 16, 2024 01:13 |
|
Tad Naff posted:Question: when did kids stop learning PHP? It used to be that was the one web language we could count on applicants to at least have run across, which is why we standardized on it. When node came out. Once people only had to learn/teach one language to do both frontend and backend, that's what everyone switched to.
|
# ? Jul 27, 2017 05:09 |
|
Yeah node is the new hotness Er I guess technically ember since that's what all the webdev people who graduated below me like
|
# ? Jul 27, 2017 05:19 |
|
Does anyone use VS Code for PHP? I tried it with the most popular extensions (a few different php IntelliSense extensions). Most of the advertised features worked nicely but I couldn't get good autocomplete suggestions for built-in php functions with any of the setups. Trying to type var to get a var_dump() suggestion only worked with the default Microsoft setting, these extensions (which tell you to disable "php.suggest.basic" and let the extensions take over) would not suggest it at all. That made VS code seem inferior to my Sublime setup.
|
# ? Jul 30, 2017 00:17 |
|
I use phpstorm when I have to touch php, which has been twice so far in six months
|
# ? Jul 30, 2017 03:20 |
|
duz posted:When node came out. Once people only had to learn/teach one language to do both frontend and backend, that's what everyone switched to. I dunno, I'm pretty sure PHP started dying as Rails and/or Django started their relevance about 7 years ago. No doubt JS (Node) is the current hotness and has basically taken up what new programmers learn nowadays.
|
# ? Jul 30, 2017 04:18 |
|
RedQueen posted:Does anyone use VS Code for PHP? I tried it with the most popular extensions (a few different php IntelliSense extensions). Most of the advertised features worked nicely but I couldn't get good autocomplete suggestions for built-in php functions with any of the setups. Trying to type var to get a var_dump() suggestion only worked with the default Microsoft setting, these extensions (which tell you to disable "php.suggest.basic" and let the extensions take over) would not suggest it at all. That made VS code seem inferior to my Sublime setup. Seconding PhpStorm. It will make things far more tolerable.
|
# ? Jul 31, 2017 10:36 |
|
Microsoft has also removed a lot of barriers to getting up and running with C# and that sweet, sweet type safety is a huge plus over PHP. PHP just doesn't have anything unique to offer people anymore. It feels super inelegant.
|
# ? Aug 15, 2017 14:45 |
|
I say the above as someone who personally has a real soft spot for PHP.
|
# ? Aug 15, 2017 14:46 |
|
If it was not for all the legacy applications and large number of internal libraries we've written, we'd probably switch to C# where I'm at.
|
# ? Aug 15, 2017 15:22 |
|
Cross posting this from the general thread: I'm really enjoying eslint. When we started a node.js project I was able to configure very specific rules for it, pass them to my team, and then enforce them by making our CI run the linter and fail any commits that don't pass. It's a nice extra layer of tidyness and some safety in the javascript world, without going to something like typescript. Is there anything as robust and customizable for PHP? I'd love to run some of the PHP stuff we still maintain through something like this, but I can't find anything that lets you be quite as specific in the settings, or also played nice with IDEs and CIs.
|
# ? Sep 1, 2017 14:47 |
|
You might be looking for PHP Mess Detector and PHP_CodeSniffer.
|
# ? Sep 1, 2017 18:09 |
I haven't done any PHP for ages. Recently updated from php5 to php7 and I'm having trouble with a "class not found" error in some old code. I have my autoloader defined as:code:
code:
|
|
# ? Sep 10, 2017 05:31 |
|
__autoload has been deprecated in the next release. You should be using spl_autoload_register instead, and should have been for literally over ten years. You should be able to sniff out the problem with a little more verbosity and a switch from include to require_once so that a failure there is more immediate and obvious. Needless to say, you should already have your error_reporting cranked all the way up to E_ALL. PHP code:
McGlockenshire fucked around with this message at 07:06 on Sep 10, 2017 |
# ? Sep 10, 2017 07:03 |
McGlockenshire posted:__autoload has been deprecated in the next release. You should be using spl_autoload_register instead, and should have been for literally over ten years. Thank you for the very thorough answer! I dropped your snippet in place of mine and it seems to be working now.
|
|
# ? Sep 10, 2017 08:42 |
|
I'm glad it's working, but I changed none of the code that actually mattered from your original. If you haven't already performed an appropriate animal sacrifice to the PHP gods, I suggest appeasing them now. Your code is haunted.
|
# ? Sep 10, 2017 22:45 |
McGlockenshire posted:I'm glad it's working, but I changed none of the code that actually mattered from your original. Haha that's what it seemed like! I have no idea what the deal was. This is for Awful Yearbook, so it is most certainly haunted.
|
|
# ? Sep 10, 2017 23:14 |
|
fletcher posted:Haha that's what it seemed like! I have no idea what the deal was. This is for Awful Yearbook, so it is most certainly haunted. That thing still exists? Huh.
|
# ? Sep 17, 2017 16:46 |
|
I'm not sure if this should really go here since it might be more of an AWS question, but I don't see an AWS/ thread so maybe one of you fine folks have an answer for me. My AWS forum post posted:I'm attempting to pull a custom metric from the Cloudwatch API via PHP and haven't been able to get it working properly. I can pull standard metrics just fine, so it's not an issue with improperly configured IAM roles or anything. I think maybe the actual statistic I'm requesting is wrong but I think I've tried it with every statistic option available. I'm trying to get the custom DiskSpaceUtilization metric in the System/Linux namespace. I have the Cloudwatch perl scripts installed on my instance and they're reporting disk statistics every 5 minutes via a cron job that I can see just fine via the Cloudwatch GUI. Requesting the custom metric via the API doesn't give me an error, it just return an empty Datapoints array. This one works php:<?php require $_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php'; use Aws\CloudWatch\CloudWatchClient; use Aws\Exception\AwsException; $client = new CloudWatchClient([ 'region' => 'us-west-2', 'version' => 'latest' ]); try { $result = $client->getMetricStatistics(array( 'Namespace' => 'AWS/EC2', 'MetricName' => 'NetworkPacketsOut', 'Dimensions' => array( array( 'Name' => 'InstanceId', 'Value' => 'i-093348c63a21c8068' ), ), 'StartTime' => strtotime('-6 hours'), 'EndTime' => strtotime('now'), 'Period' => 60, 'Statistics' => array('Average'), )); echo '<pre>'; var_dump($result); echo '</pre>'; } catch (AwsException $e) { error_log($e->getMessage()); } ?> php:<?php require $_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php'; use Aws\CloudWatch\CloudWatchClient; use Aws\Exception\AwsException; $client = new CloudWatchClient([ 'region' => 'us-west-2', 'version' => 'latest' ]); try { $result = $client->getMetricStatistics(array( 'Namespace' => 'System/Linux', 'MetricName' => 'DiskSpaceUtilization', 'Dimensions' => array( array( 'Name' => 'InstanceId', 'Value' => 'i-093348c63a21c8068' ), array( 'Name' => 'MounthPath', 'Value' => '/' ), array( 'Name' => 'Filesystem', 'Value' => '/dev/xda1/' ), ), 'StartTime' => strtotime('-6 hours'), 'EndTime' => strtotime('now'), 'Period' => 60, 'Statistics' => array('Maximum', 'Minimum', 'Average', 'Sum', 'SampleCount'), )); echo '<pre>'; var_dump($result); echo '</pre>'; } catch (AwsException $e) { error_log($e->getMessage()); } ?>
|
# ? Oct 14, 2017 00:14 |
MounthPath instead of MountPath?
|
|
# ? Oct 14, 2017 11:51 |
|
Well thank you for pointing that out, I'm a dummy, but unfortunately fixing it didn't actually fix the issue (and I'm actually pretty sure I had tried it the right way at some point but screwed it up when I was copy/pasting things in and out of that dimensions array). I may just move on to something else, building a bespoke AWS dashboard seemed like a fun way to learn php but I'm not doing anything that isn't already done much better by the Cloudwatch dashboard anyway. I learned how to install/use the AWS PHP SDK, maybe I should just build a page that will let me provision/destroy hosts from a single page. Thanks for taking a look at it.
|
# ? Oct 14, 2017 17:42 |
|
Ok. All ears for any tips on where to start on something. Im ready to do my own work but just lacking any kind of direction to go in right now. Ive been assigned a ticket at work that basically was framed as follows: Estimate the number of hardcoded strings in the app. This is for the purpose of getting some kind of estimates for how much work will be involved i18n-wise to internationalizing the app/ translate it. The thing is, its a PHP Symfony 1.x based project where there are strings all over all place in HTML and Echo'd from PHP and put in place by JavaScript. Its not a straightforward thing. Ive explained this to the project lead that the idea of hard-coded string is a bit misleading/not applicable but the response was basically "thanks for your research- go with what you can to get the best estimate possible". So throwing a pebble out there and wondering if anyone has had any experience doing this kind of thing on a relatively legacy PHP project
|
# ? Oct 29, 2017 23:52 |
|
What is their definition of a "hardcoded string"? Why is this being asked for?
|
# ? Oct 30, 2017 00:22 |
|
McGlockenshire posted:What is their definition of a "hardcoded string"? e: There is no definition given. Its for the purpose of estimating how much content is user facing that will need to be translated. In some apps like Java I imagine there is a clear distinction between whats a hardcoded string or not, so you could do some stuff with an IDE or commands to estimate how many such strings exist. Im guessing that my boss has read some stuff about getting translation work done and it said the first step is to estimate the strings in the app somewhere. I think I am going to have to pushback and explain again that what I am being asked A) isn't clear b) Is very hard to do with how unclear it is Murrah fucked around with this message at 01:02 on Oct 30, 2017 |
# ? Oct 30, 2017 00:59 |
|
Yeah, unless the application was built under the assumption that it'd need to be translated later, there's going to be no really easy way to get an estimate anywhere near close to reality without actually counting. Translatable strings could be anywhere throughout the entire structure of the application. Don't forget about error messages, etc. You could probably fake it by processing the output of each page through a browser. Every non-empty text node in the DOM is likely to be at least one string appearing somewhere in the source. That might give you a reasonable lower bounds. I'd be very careful with the number. As you've already guessed, this might be for some external contractor to get a copy of the source and mangle it based on the estimate that you provide, meaning a bad estimate could result in them wanting more money later, etc. McGlockenshire fucked around with this message at 02:07 on Oct 30, 2017 |
# ? Oct 30, 2017 02:03 |
|
I would overestimate rather than underestimate, just to be sure
|
# ? Oct 30, 2017 02:21 |
|
Wouldn't a regex count pass through all the files at least give an idea?
|
# ? Oct 30, 2017 08:05 |
|
Yeah, if they just want a rough estimate then do a grep for ' = "' or something. Then add a large number to represent the strings in the HTML files.
|
# ? Oct 30, 2017 18:45 |
|
So, I have a client who wants to take their Excell spreadsheet of ID Numbers and copy-paste it into a textfield to apply a status to it. Currently I have explode() doing that but I'm not sure what character I use for a new row for excell, any help?
|
# ? Nov 6, 2017 09:21 |
|
ConanThe3rd posted:So, I have a client who wants to take their Excell spreadsheet of ID Numbers and copy-paste it into a textfield to apply a status to it. Can you get the format in CSV instead?
|
# ? Nov 6, 2017 22:05 |
|
kiwid posted:Can you get the format in CSV instead? :/ I was affraid that was the answer.
|
# ? Nov 9, 2017 09:53 |
|
ConanThe3rd posted:So, I have a client who wants to take their Excell spreadsheet of ID Numbers and copy-paste it into a textfield to apply a status to it. If you can have them upload the file rather than copying and pasting the data, you can use https://packagist.org/packages/phpoffice/phpexcel to process it.
|
# ? Nov 9, 2017 17:57 |
ConanThe3rd posted:So, I have a client who wants to take their Excell spreadsheet of ID Numbers and copy-paste it into a textfield to apply a status to it. If you implement a rich-text editor (i.e. a contentEditable HTML thing), copy-paste from Excel will usually end up as an actual HTML table you can traverse client side with DOM, or submit and parse as HTML.
|
|
# ? Nov 9, 2017 20:21 |
|
If they're ID numbers could you not just regex them?
|
# ? Nov 15, 2017 12:04 |
|
E: NVM, forgot there is an entire wordpress thread
Murrah fucked around with this message at 05:00 on Nov 17, 2017 |
# ? Nov 17, 2017 04:53 |
|
Does anyone have any recommendations for beginner PHP tutorials for creating REST APIs?
teen phone cutie fucked around with this message at 19:24 on Dec 7, 2017 |
# ? Dec 7, 2017 16:29 |
|
I would just play about with a framework's documentation, rather than working through any tutorial. https://silex.symfony.com/ Silex is a good choice because it doesn't hide tooooooo much from you under a layer of magic but you can get a lot done quickly with it (I am a symfony fanboy, silex's big brother). Programming is all about abstraction of course so you should be able to read a blog post or book or what ever on REST that's language agnostic and apply the RESTful pattern to the silex routing component. Likewise, you could pick any different framework and do the same thing. Switch in whatever framework you like, they all have routing components. I wouldn't bother writing your own routing component though, plenty of people would recommend that you do, however.
|
# ? Jan 12, 2018 11:11 |
|
Personally I wouldn't go for Silex right now as it's been end-of-life'd. Slim or Lumen maybe instead? Depends what your starting point is.
|
# ? Jan 12, 2018 11:55 |
|
Well i guess the reason I want to learn REST practices in PHP is mostly because we use PHP at work on our apps. And i’ve been making my best attempt to be more of a full stack developer, as I’ve pretty much been doing frontend through my career. But I’ll be sure to read through the docs of these frameworks and see what i like!
|
# ? Jan 12, 2018 14:24 |
|
|
# ? May 16, 2024 01:13 |
|
Ah yeah, I guess the plan is for Symfony flex to take over Silex. Lumen might be a good choice for the same reason as Silex. You can use it as a stepping stone into the big brother framework (Laravel) without having too much of whats going on hidden from you. It really doesn't matter what framework you use, as long as you learn it well. What do your backend developers use?
|
# ? Jan 12, 2018 14:30 |