News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

E
December 19, 2014 @ 11:56:41

On the SitePoint PHP blog a new tutorial has been posted showing you how to effectively search Chinese content with ElasticSearch. ElasticSearch is a "powerful open source search and analytics engine that makes data easy to explore" and plays nice with PHP via a JSON based query format.

If you have played with Elasticsearch, you already know that analyzing and tokenization are the most important steps while indexing content, and without them your pertinency is going to be bad, your users unhappy and your results poorly sorted. Even with English content you can lose pertinence with a bad stemming, miss some documents when not performing proper elision and so on. And that's worse if you are indexing another language; the default analyzers are not all-purpose. When dealing with Chinese documents, everything is even more complex, even by considering only Mandarin which is the official language in China and the most spoken worldwide.

He starts by explaining exactly what the problem is with searching Chinese content including the fact that some words can actually be a combination of two or more characters (words). He then lists out a few plugins and tools that can be integrated with ElasticSearch to help with analyzing the content. He goes through each of them and provides instructions on installation and usage. He ends the post with a sample of the results for a set of three search terms, comparing the matches each found.

0 comments voice your opinion now!
chinese search elasticsearch tutorial tokenization analysis

Link: http://www.sitepoint.com/efficient-chinese-search-elasticsearch/

Reddit.com:
Composer files being indexed by Google
December 10, 2014 @ 11:36:55

In an interesting thread on the /r/php subreddit on Reddit.com, a user noticed that Google is indexing Composer files that are in the document root of PHP applications. These files, like "composer.json" and "composer.lock" can provide detailed information about which packages and libraries are in use in the application (information disclosure).

The problem is that these files are placed in the web root of the application and not in a folder one level up, a recommended practice. The post links to a Google search that shows an example of current sites with the issue.

Another comment in the same post also reminds users not to have things like their ".git" files in the document root either as they can provide valuable information to would be attackers about your application's code. Things can be done to prevent direct access to these files in the web server configuration but it's far better to restructure the application to have them in a parent directory of the actual web root.

0 comments voice your opinion now!
composer files composerlock composerjson index google search engine security

Link: http://www.reddit.com/r/PHP/comments/2ourf7/composer_files_being_indexed_by_google/

SitePoint PHP Blog:
Geospatial Search with SOLR and Solarium
November 25, 2014 @ 13:55:56

The SitePoint PHP blog has a new post from Lukas White that gets into the details of combining SOLR searching with Solarium to perform geospatial queries.

In a recent series of articles I looked in detail at Apache's SOLR and Solarium. To recap; SOLR is a search service with a raft of features - such as faceted search and result highlighting - which runs as a web service. Solarium is a PHP library which allows you to integrate with SOLR - whether local or remote - interacting with it as if it were a native component of your application. If you're unfamiliar with either, then my series is over here, and I'd urge you to take a look. In this article, I'm going to look at another part of SOLR which warrants its own discussion; Geospatial search.

He uses a simple example, locating airports near a given location, to give a more "real world" idea of how it all works. He starts by introducing the concept of geospatial searching and the idea of "points" as they relate to a specific location. He then gets into the actual setup of the application, including the SOLR schema configuration and making the queries on the data. The Solarium library allows for simple location queries when given just the "latlong" helper type and the location/distance to use for the starting point. He uses the data from the OpenFlights service to gather the airport data and creates a search form and basic list output of the results from searches on it. If you'd like to see the end result in action, check out this demo website.

0 comments voice your opinion now!
solr search solarium library tutorial geospatial query airport demo

Link: http://www.sitepoint.com/geospatial-search-solr-solarium/

Sameer Borate:
Creating Twitter Apps in PHP
September 29, 2014 @ 09:28:42

Sameer Borate has a post today showing how you can create a simple Twitter application in PHP making use of their REST API and the twitter-api-php library.

In this post we will look into accessing Twitter REST API in PHP. This can be useful if you need to post Tweets from your PHP application or anaylze, search Tweets. In the following examples we will use the twitter-api-php PHP wrapper for Twitter v1.1 API. Although there are a few wrappers around, this one I like for its simplicity.

He helps you get the library installed (via Composer) and create an application on the Twitter side at apps.twitter.com. Sample code is included showing how to connect to the API with your credentials, including handling the OAuth authorization piece. From there he shows two examples of action to make on the API: posting a new tweet and searching for new tweets based on a query string.

0 comments voice your opinion now!
twitter application tutorial introduction library oauth search post tweet

Link: http://www.codediesel.com/social/creating-twitter-apps-in-php/

SitePoint PHP Blog:
PINQ - Querify Your Datasets - Faceted Search
August 26, 2014 @ 10:58:22

The SitePoint PHP blog has continued their series showing the use of the PINQ library for PHP (a PHP implementation of the LINQ tool). In part one they introduced the tool and showed how to it could be used to query and sort data. In this second part they move on and show how to perform a multi-faceted search on data from a MySQL database.

We are not going to cover the full aspect of faceted search in this series. Interested parties can refer to relevant articles published on Sitepoint and other Internet publications. [...] Unfortunately, faceted search is not a built-in feature provided by MySQL yet. What can we do if we are using MySQL but also want to provide our users with such a feature? With PINQ, we'll see there is an equally powerful and straightforward approach to achieving this as when we are using other DB engines - at least in a way.

Building from the code from the first part of the series, they create a few more simple routes that let you define the different facets to use for the searching/sorting. He creates a custom facet class that uses the "traversable" handling of the PINQ to do the data manipulation. He creates a few different facet objects, each creating a customized filter. finally, he ties it all back into the endpoint and includes the updated markup to show the results. He finishes up the post mentioning a few limitations and improvements that could be made on the example as well.

0 comments voice your opinion now!
pinq query dataset mysql faceted search tutorial series part2

Link: http://www.sitepoint.com/pinq-querify-datasets-faceted-search/

Sameer Borate:
Downloading Gmail attachments in PHP - an update
July 29, 2014 @ 09:37:40

Sameer Borate has posted an update to a previous post of his about downloading attachments in PHP. In this new post he updates the script to remove any other dependencies other than the IMAP PHP extension.

As mentioned in the earlier post, automatically extracting attachments from Gmail can be important for reasons where you need to process the attached files periodically with a CRON job or need to process the files programmatically. Also it can be useful for automatically archiving important attachments. [The code in this post] is a simple proof-of-concept plain PHP code, devoid of any object-oriented features that extracts attachments from your Gmail account.

The example code makes a request to the Gmail IMAP servers with the given username and password, grabs the first set of emails, parses their attachments to pull them down to the local host. He also includes some searching capability to locate ones only matching certain criteria. A list of the allowed search keywords is also included. He finishes the post with a look at using READONLY mode and fetching the email headers.

0 comments voice your opinion now!
attachment download gmail tutorial search

Link: http://www.codediesel.com/php/downloading-gmail-attachments-in-php-an-update/

SitePoint PHP Blog:
Using Solarium with SOLR for Search - Advanced
May 08, 2014 @ 11:56:46

The SitePoint PHP blog has finished off their series showing you how to integrate searching with SOLR (via Solarium) into your PHP application. In this last part of the series, Lukas White gets into some of the more advanced topics around searching and handling the resulting output in your views.

In the first three parts we installed and configured SOLR and Solarium and started building an example application for searching movies. We've also looked at faceted search. We're going to wrap up the series by looking at some more advanced features of SOLR, and how to use them with Solarium.

He's broken up the rest of the tutorial to talk about a few of these more advanced features like:

  • Highlighting search matches in the output of documents (depending on the type of match)
  • Using the searching for an autocomplete
  • Configuring and making the request with an array-based configuration (a more manual process)
  • Adding additional cores to the search (allowing for more flexibility on search styles and configurations)

He also points to two other resources that could be handy along your path to SOLR dominance: the SOLR reference guide and the official Solarium documentation.

0 comments voice your opinion now!
solr search solarium library tutorial series part4 advanced

Link: http://www.sitepoint.com/using-solarium-solr-search-advanced/

SitePoint PHP Blog:
Using Solarium with SOLR for Search - Implementation
May 07, 2014 @ 10:54:10

The SitePoint PHP blog has posted the third part of their series looking at using the Solarium tool to hook your PHP application into a SOLR search instance. In this latest part of the series they get down to the actual search implementation.

In the first part I introduced the key concepts and we installed and set up SOLR. In part two we installed and configured Solarium, a library which enables us to use PHP to "talk" to SOLR as if it were a native component. Now we're finally ready to start building the search mechanism, which is the subject of this installment.

He starts with a simple search example, making a request to select the matches for a given query (given on the URL as a variable "q"). He shows how to run the select and fetch the results as a result set. He enhances this, containing the search logic inside a class and making a template to show the results. He also includes examples of how to use the "Disjunction Max", sorting and pagination functionality. Finally, he looks at a more complex type of search, a faceted search, and includes code examples of making the request and displaying the results.

0 comments voice your opinion now!
solr solarium search engine tutorial implement basics faceted

Link: http://www.sitepoint.com/using-solarium-solr-search-implementation/

SitePoint PHP Blog:
Using Solarium with SOLR for Search - Solarium and GUI
May 06, 2014 @ 13:49:34

The SitePoint PHP blog continues their series looking at the use of the Solarium tool to work with the SOLR searching tool in PHP. In this latest part (part two) of the series they move beyond the setup and configuration and get into some actual code to use the server.

This is the second article in a four part series on using Solarium, in conjunction with Apache's SOLR search implementation. In the first part, I introduced the key concepts and we installed and set up SOLR. In this second part we'll install Solarium, start building an example application, populate the search index and get into a position where we can start running searches.

The frontend, based on the Laravel framework, is simple to get up and running with just a few lines of code. They walk you through the basic CRUD kinds of steps, "pinging" the server to ensure it's up and searching the documents you've added.

0 comments voice your opinion now!
solarium solr search gui laravel crud

Link: http://www.sitepoint.com/using-solarium-solr-search-solarium-gui/

SitePoint PHP Blog:
Using Solarium with SOLR for Search - Setup
May 02, 2014 @ 11:49:16

The SitePoint PHP blog has posted a tutorial showing you how to use the Solarium library to search SOLR. Solarium is a PHP-based, open source tool that helps make interfacing with a SOLR search instance much easier. This post is part one of a larger series covering the combination of SOLR and Solarium.

Apache's SOLR is an enterprise-level search platform based on Apache Lucene. It provides a powerful full-text search along with advanced features such as faceted search, result highlighting and geospatial search. [...] If you're using PHP then the Solarium Project makes integration even easier, providing a level of abstraction over the underlying requests which enables you to use SOLR as if it were a native implementation running within your application. In this series, I'm going to introduce both SOLR and Solarium side-by-side.

He starts with some of the basic concepts behind what SOLR is, what kinds of things it's useful for and how to get it installed on your system (using Homebrew). He shows how to set up a sample schema including a detailed look at the different types and required fields it will need. As this is just the first part of the series, it stops there and will get into the actual PHP code for the interface in the next edition.

0 comments voice your opinion now!
solr solarium search engine tutorial interface opensource library

Link: http://www.sitepoint.com/using-solarium-solr-search-setup/


Community Events





Don't see your event here?
Let us know!


tool artisanfiles interview laravel version symfony language introduction opinion framework library release conference podcast security list series voicesoftheelephpant composer community

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework